Question

I need to print a page in custom Paper Size as defined in the System (Windows)/ Printer and Faxes.

I am using this FireFox Extension "JS Print Setup". I got through their documentation http://jsprintsetup.mozdev.org/reference.html

It has function to get the System Printer List

jsPrintSetup.getPrintersList()

But I cannot find any functions that can get me the System Paper Sizes. The one the have is

jsPrintSetup.getPaperSizeList() // not getting system Paper Sizes :(

But it gives it's own paper sizes, not from the system.

So how can I select the system paper size through the extension or if that's not possible then create one in the extension?

Side note: I am using this extension because of its ability to silent print by selecting(through code) the printers and paper size (not happened yet).

Was it helpful?

Solution

For Now i could not find a way to use system Paper Sizes but did find a way to add new paper sizes to the jsPrintSetup.getPaperSizeList()

jsPrintSetup.definePaperSize(101, 101, "Custom", "Custom_Paper", "Custom PAPER", 250, 400, 
jsPrintSetup.kPaperSizeMillimeters);
jsPrintSetup.setPaperSizeData(101);

According to the Documentation

void definePaperSize(in short jspid, in short pd, in wstring pn, in wstring pwg, in wstring name, in double w, in double h, in short m); 

OTHER TIPS

On different platforms and their printing subsystem paper definitions are different. jsPrintSetup is using own built-in list with paper definitions with own IDs and matching to platform specific IDs. You can view predefined list of paper definitions and use these which are most suitable for your case. (http://jsprintsetup.mozdev.org/reference.html#ENHANCED_PAPERHANDLING) For example if you want to use ISO A4 paper size you can call jsPrintSetup.setPaperSizeData(10); To use custom paper sizes you must first define in platform printing system and next to define in jsPrintSetup with correct paperData and paperName values. The simplest way to find them is to get it from about:config after manual print from Firefox to this paper. (print.printer_{your printer name}.paper_data and print.printer_{your printer name}.paper_name)

I hope that this will help you!

Regards,

Dimitar Angelov

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top