I find the developer link; https://developer.chrome.com/extensions/printerProvider
But, couldn't understand how to use it.
I've tried to print the current page without showing a print popup.
To be able to achieve it, I look printer provider, but was not successful.
manifest.json:
{
"name": "Print this page",
"description": "Adds a print button to the browser.",
"version": "1.1",
"background": {
"scripts": ["background.js"]
},
"permissions": [
"tabs", "http://*/*", "https://*/*", "printerProvider"
],
"browser_action": {
"default_icon": "icon.png"
},
"manifest_version": 2
}
background.js
chrome.printerProvider.onGetCapabilityRequested.addListener(function callback) {
alert(callback);
});
chrome.printerProvider.onGetPrintersRequested.addListener(function callback){
console.log(callback);
});
But, these callbacks return nothing.
How can I use/trigger these events?