1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 07:08:08 +02:00
pdf.js/web
Rob Wu 1731c0fb42 Add mozPrintCallback shim
This shim does the following:
1. Intercept window.print()
2. For a window.print() call (if allowed, ie. no previous print job):
   1. Dispatch the beforeprint event.
   2. Render a printg progress dialog.
   3. For each canvas, call mozPrintCallback if existent (one at a time, async).
   4. During each mozPrintCallback callback, update the progress dialog.
   5. When all <canvas>es have been rendered, invoke the real window.print().
   6. Dispatch the afterprint event.

The shim is not included in Firefox through the preprocessor.

Keyboard shortcuts (Ctrl/Cmd + P) are intercepted and default behavior
(i.e. printing) is prevented, and the steps for window.print() are run.
window.attachEvent is used, in order to cancel printing in IE10 and
earlier (courtesy of Stack Overflow - http://stackoverflow.com/a/15302847).
Unfortunately, this doesn't work in IE11 - if Ctrl + P is used, the
print dialog will be shown twice: Once because of Ctrl + P, and again
when all pages have finished rendering.

This logic of this polyfill is not specific to PDF.js, so it can also
be used in other projects.

There's one additional modification in PDF.js's viewer.js: The printed
<canvas> element is wrapped in a <div>. This is needed, because Chrome
would otherwise print one canvas on two pages.
2013-10-08 19:46:59 +02:00
..
images Improvements for RTL languages 2013-09-14 19:33:00 +02:00
.gitignore Updates webL10n; using viewer.properties as is 2012-11-29 14:02:33 -06:00
compatibility.js Disable range requests in old Android versions 2013-08-29 01:53:57 +02:00
compressed.tracemonkey-pldi-09.pdf Add Makefile. Move some files around to make building the website easier. 2011-07-05 10:53:57 -07:00
debugger.js Show sensible output for showText commands in the stepper. 2013-08-14 15:34:55 -07:00
download_manager.js Rejects incorrect url in download manager 2013-07-12 13:38:49 -05:00
firefoxcom.js Restoring PR 3455 functionality 2013-07-12 17:00:43 -05:00
index.html.template Update web/index.html.template 2012-10-02 07:26:20 -05:00
mozPrintCallback_polyfill.js Add mozPrintCallback shim 2013-10-08 19:46:59 +02:00
page_view.js Add mozPrintCallback shim 2013-10-08 19:46:59 +02:00
password_prompt.js Improved password prompt 2013-09-24 17:46:54 +02:00
pdf_find_bar.js pr #3356 2013-06-18 09:05:55 -07:00
pdf_find_controller.js Prevent searching during load from breaking the find functionality 2013-09-05 00:25:19 +02:00
pdf_history.js Merge pull request #3582 from Rob--W/pushState 2013-10-03 11:35:36 -07:00
presentation_mode.js Refactor Presentation Mode code 2013-10-06 20:10:26 +02:00
secondary_toolbar.js Move Presentation Mode related code from viewer.js to its own file 2013-10-01 23:11:46 +02:00
settings.js Fix coding style and improve comment in settings.js 2013-10-02 15:57:23 +02:00
text_layer_builder.js implementing transform matrix to getTextContent 2013-09-20 06:37:08 +05:30
thumbnail_view.js Move ThumbnailView from viewer.js to its own file 2013-08-06 22:19:03 +02:00
ui_utils.js Use canvas and css width/height instead of css transform for high dpi. 2013-09-20 12:11:14 -07:00
viewer-snippet-b2g-activity-header.html Add close button and title bar for b2g. 2012-11-28 11:02:56 -08:00
viewer-snippet-firefox-extension.html Un-inline pdf.js for the extension/mozcentral and remove fetch pdf by content code. 2012-10-29 12:44:18 -07:00
viewer-snippet-mozPrintCallback-polyfill.html Add mozPrintCallback shim 2013-10-08 19:46:59 +02:00
viewer-snippet.html Updates webL10n; using viewer.properties as is 2012-11-29 14:02:33 -06:00
viewer.css Merge pull request #3739 from Snuffleupagus/bug-921162 2013-10-04 13:16:38 -07:00
viewer.html Add mozPrintCallback shim 2013-10-08 19:46:59 +02:00
viewer.js Add mozPrintCallback shim 2013-10-08 19:46:59 +02:00