JS print Setup - Select System Paper Size?

Ruchan picture Ruchan · Aug 8, 2013 · Viewed 10.1k times · Source

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).

Answer

Ruchan picture Ruchan · Aug 8, 2013

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);