问题
I trying to use chrome.printerProvider to make a printing extension. Can anyone give me an example about PrintInfo id ? I'm request print via network and I setting PrintInfo Id by printer address but it's not working. Here is my script:
chrome.printerProvider.onGetPrintersRequested.addListener(function callback(resultCallback) {
resultCallback([{
id: '192.16.1.18', // printer address
name: 'My Printer',
}]);
});
or
chrome.printerProvider.onGetPrintersRequested.addListener(function callback(resultCallback) {
resultCallback([{
id: 'net://192.16.1.18', // printer address
name: 'My Printer',
}]);
});
回答1:
This should work..
chrome.printerProvider.onGetPrintersRequested.addListener(
function ( resultCallback ) {
resultCallback( [{
id: 'net://192.16.1.18', // printer address
name: 'My Printer',
}] );
}
);
来源:https://stackoverflow.com/questions/34903590/google-javascript-api-chrome-printerprovider-printer-id-format