Using an Extension to modify a print job ("chrome.printerProvider" API)

2,928 views
Skip to first unread message

Michael Angstadt

unread,
Jul 30, 2015, 11:31:34 AM7/30/15
to extensions-dev
Hello,

I hope this is the right place to ask this question!

I want to write a Chrome extension that will "intercept" a print job, modify it, and then send the modified print job to a printer.

I've been trying to use the "chrome.printerProvider" API[1] to accomplish this, but it doesn't seem to do quite what I want. The problem is that the API only seems to allow you to create you own, "fake" printers and interact with them. You can't interact with the "real" printers that your computer is connected to.

The reason I want to do this is that I want to modify the headers and footers that Chrome puts on each printed page. I was thinking: I could use this printing API to tell Chrome to generate a PDF for printing. Then, I could intercept the PDF, modify it, and then send the modified version to the printer.

Thank you.

[1]: https://developer.chrome.com/extensions/printerProvider

Reilly Grant

unread,
Jul 30, 2015, 3:33:11 PM7/30/15
to Michael Angstadt, extensions-dev
You can use chrome.printerProvider to create a fake printer that modifies the PDF and then prints it but the user experience will be pretty poor.

If you want to modify the printed content could you perhaps create an extension that modifies the page being printed instead?

--
You received this message because you are subscribed to the Google Groups "extensions-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to extensions-de...@chromium.org.
For more options, visit https://groups.google.com/a/chromium.org/d/optout.

Michael Angstadt

unread,
Jul 30, 2015, 4:58:51 PM7/30/15
to extensions-dev, rei...@chromium.org
Hi Reilly,

Thanks for the response.

Yes, I can use "chrome.printerProvider" to create a fake printer that modifies the PDF. But I can't (or don't know how to) actually print that PDF.

Modifying the webpage wouldn't do me any good because I want to modify the header and footers that Chrome adds to the printed document. The headers and footers do not exist on the webpage itself.

Reilly Grant

unread,
Jul 31, 2015, 12:05:46 PM7/31/15
to Michael Angstadt, extensions-dev

jerry zhang

unread,
Dec 19, 2015, 11:45:17 AM12/19/15
to extensions-dev, mike.a...@gmail.com
hey,everyone: ) can you see me?~
is there any possible to print word with "silent mod"

Geoff Speedie

unread,
May 16, 2019, 8:20:57 AM5/16/19
to extensions-dev, rei...@chromium.org, mike.a...@gmail.com
On Thursday, 30 July 2015 16:58:51 UTC-4, Michael Angstadt wrote:
> Hi Reilly,
>
> Thanks for the response.
>
> Yes, I can use "chrome.printerProvider" to create a fake printer that modifies the PDF. But I can't (or don't know how to) actually print that PDF.
>
> Modifying the webpage wouldn't do me any good because I want to modify the header and footers that Chrome adds to the printed document. The headers and footers do not exist on the webpage itself.
>
> On Thursday, July 30, 2015 at 3:33:11 PM UTC-4, Reilly Grant wrote:
> > You can use chrome.printerProvider to create a fake printer that modifies the PDF and then prints it but the user experience will be pretty poor.
> >
> >
> > If you want to modify the printed content could you perhaps create an extension that modifies the page being printed instead?
> >
> >


so I need an extension, that with one click of it, it prints the page, and skips all the prompts. I just want it to print 1 page, instantly. I do not want the multiple pop ups. Is there a way to do that in chrome? if not can it even be done? I am no dev, so I have no idea if it is even possible. But that is what I am looking for. I was not sure if that was the same as silent printing.

If anyone can help, or at least point me in the direction i need, i would be grateful!!!

Geoff Speedie

unread,
May 16, 2019, 8:21:20 AM5/16/19
to extensions-dev, mike.a...@gmail.com

eswar yaga

unread,
May 16, 2019, 8:26:33 AM5/16/19
to extensions-dev, mike.a...@gmail.com
Reply all
Reply to author
Forward
0 new messages