29 ms·
The browser has no way to send anything directly to the printer through javascript and probably not the best idea to let it either from a security perspective,
by SigmundA 6y ago
The browser has no way to send anything directly to the printer through javascript and probably not the best idea to let it either from a security perspective, especially PDF's.
It's up to the browser to render the page to the printer, if it contains canvases they are sent as bitmaps, since thats what they are.
HTML elements and SVG are generally rendered as vector commands to the printer which might end up being postscript or pdf. So svg's are much lighter going to printer then high dpi canvases. They also looks much better too since the printer renders them to the final raster at native res say 600 dpi.
Other browsers use a native PDF renders that can do whatever it wants, not sure what PDFium does in Chrome/Edge maybe it just sends the PDF if it can determine the printer supports it, otherwise it does native print commands for sure, it does not send bitmaps.
The nice thing about pdf.js is it runs on platforms that have no pdf viewer built in but have a web browser or maybe a buggy built in one. You can also style and control it yourself and add features to it for your app making for tighter embedding. Also it can be updated independently of browser.