When printing a PDF document, WebKit should integrate with PDF.js's print functionality and not print the PDF.js UI itself.
(In reply to Michael Catanzaro from comment #0) > When printing a PDF document Specifically, the problem occurs when printing the document using the browser's print UI rather than PDF.js's print UI. Presumably it wouldn't happen if using the print button in PDF.js itself. That button is actually broken, but it looks like bug #260771, so I'll expand the scope of that bug instead of reporting a new one.
<rdar://problem/116435714>
I would suggest as a starter to use `@media (print)` in the custom stylesheets to make printing behave as expected + somehow force the print button to load all the PDF pages. Alternatively, there might be a better way if you somehow use messaging + PDF.JS APIs to print.
(In reply to Tim Nguyen (:ntim) from comment #3) > Alternatively, there might be a better way if you somehow use messaging + > PDF.JS APIs to print. This will be a better (and probably easier) solution. Basically we should forward WebKit's print command to PDF.js, which knows how to prepare the document properly.
(In reply to Michael Catanzaro from comment #4) > (In reply to Tim Nguyen (:ntim) from comment #3) > > Alternatively, there might be a better way if you somehow use messaging + > > PDF.JS APIs to print. > > This will be a better (and probably easier) solution. Basically we should > forward WebKit's print command to PDF.js, which knows how to prepare the > document properly. You can look at how the custom context menu commands are handled for messaging to PDF.JS.