JS Print Setup

Author(s):



Client side Javascript printer settings.
Extension creates global object called 'jsPrintSetup', which implements methods to get/set print Page Setup options. This is useful for developers which want to control page setup options from their Javascript code.
Some of main features are:
- Get/Set print settings - margins, orientation, scaling, header and footer
- Get/Set global print settings and for selected printer
- Working with installed printers
- Save print settings to user preferences
- Print with current setttings without need from saving to user pereferences as required from 'window.print()'
- Print desired window or frame
- Unattended printing without print dialog

From 9 Nov 2015 jsPrintSetup project migrated from mozdev.org to GitHub.

Detailed reference of the extension can be found at project home page https://github.com/edabg/jsprintsetup/wiki

Version 0.9.0 introduce domain access control. Please read notes about new security features at Security Access Control in reference.
Sample code which demonstrate using of JSPrintSetup to setup print margins and call unattended print method (without print dialog).

// set portrait orientation
jsPrintSetup.setOption('orientation', jsPrintSetup.kPortraitOrientation);
// set top margins in millimeters
jsPrintSetup.setOption('marginTop', 15);
jsPrintSetup.setOption('marginBottom', 15);
jsPrintSetup.setOption('marginLeft', 20);
jsPrintSetup.setOption(' marginRight', 10);
// set page header
jsPrintSetup.setOption('headerStrLeft', 'My custom header');
jsPrintSetup.setOption('headerStrCenter', '');
jsPrintSetup.setOption('headerStrRight', '&PT');
// set empty page footer
jsPrintSetup.setOption('footerStrLeft', '');
jsPrintSetup.setOption('footerStrCenter', '');
jsPrintSetup.setOption('footerStrRight', '');
// Suppress print dialog
jsPrintSetup.setSilentPrint(true);
// Do Print
jsPrintSetup.print();
// Restore print dialog
jsPrintSetup.setSilentPrint(false);


Download files:

js-print-setup-0.8.1.xpi
js-print-setup-0.8.2b.xpi
js-print-setup-0.8.2d.xpi
js-print-setup-0.8.2e.xpi
js-print-setup-0.8.2g.xpi
js-print-setup-0.8.2h.xpi
js-print-setup-0.9.0.1-signed.1-signed.xpi
js-print-setup-0.9.1.1-signed.1-signed.xpi
js-print-setup-0.9.2.1-signed.1-signed.xpi
js-print-setup-0.9.4.1-signed.1-signed.1-signed-linux.xpi
js-print-setup-0.9.4.1-signed.1-signed.1-signed-mac.xpi
js-print-setup-0.9.4.1-signed.1-signed.1-signed-windows.xpi
js-print-setup-0.9.5.1-signed.xpi
js-print-setup-0.9.5.1.1-signed.xpi
js-print-setup-0.9.5.2.xpi
js-print-setup-0.9.5.3.xpi
js-print-setup-0.9.5.4.xpi
js-print-setup-0.9.5.5.xpi


This page is part of the LegacyCollector website.
Disclaimer: All material on this site is property of their respective owners and available under
open licenses to the best of our knowledge. If you are an author and would like anything removed,
then please write an e-mail to legacy [at] collector dot org.