Google JavaScript API - Chrome.printerProvider: Printer id format

▼魔方 西西 提交于 2021-01-29 06:20:58

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!