Open bogal opened 7 years ago
I should add, that:
console.log(jsPrintSetup.getPaperMeasure());
outputs:
{"PD":null,"W":50.8,"H":76.2}
I'm not sure what these measurements are, as they are neither defined in about:config, or realistic paper sizes for this printer.
Also in the above example, the parameter "imageFrame" for the doPrint function is an iframe with the src set to a .png image - and i am calling jsPrintSetup.printWindow(imageFrame) to print just this.
paper_data
for your custom paper form. The simplest way is to print manually on this form and then inspect value of print.printer_ZDesigner_GK420d.print_paper_data
.
For linux toy have to obtain value of print.printer_ZDesigner_GK420d.print_paper_name
// ...
var paper_data = 105; // For windows value obtained in step 2 for print.printer_ZDesigner_GK420d.print_paper_data
var paper_name = 'Custom'; // For linux value of print.printer_ZDesigner_GK420d.print_paper_name
jsPrintSetup.definePaperSize(101,paper_data, paper_name, "Custom_Paper", "Custom PAPER",108,297,jsPrintSetup.kPaperSizeMillimeters);
jsPrintSetup.setPaperSizeData(101);
// ...
I hope that this will solve the problem.
Thanks for the reply.
I was able to workaround this, by setting the paper sizes in about:config.
print.printer_ZDesigner_GK420d.print_paper_height; 150.00 print.printer_ZDesigner_GK420d.print_paper_width;100.00
I removed the scaling function, and call to custom paper size, and it printed perfectly. Will this cause any problems long-term? I'm assuming that because the paper size is now hard-coded it will only work on this specific paper? Not so much a problem here as this printer is a dedicated dispatch label printer, that is always going to be using the same size paper.
I would prefer a proper fix though, so followed your steps: 1) Created the custom paper size in windows ok (i'm developing on win10 machine, to be run on web linux server - will that still work?). Cannot set the custom paper size in the print software as the instructions suggest, as i get a different screen to the default win10 printer settings (assuming it was installed with the drivers). There is no option to set the default paper size.
You have to create form in 'Print server properties'
Yes i created the form ok. But i can't do step 2 of that tutorial "Select the new custom paper size in the printer software" - where i select the new paper size as the printer default. Without doing that, print.printer_ZDesigner_GK420d.print_paper_data is -1 and print.printer_ZDesigner_GK420d.print_paper_name is an empty string.
Form Firefox print manually print to this printer selecting your custom form.
Even using the PDFCreator as the printer, it is not allowing me to choose the custom paper size. See pics attached, as well as a screenshot of print server settings showing the custom form present.
Microsoft Print to PDF doesn't support custom paper size. I have used PDFCreator. If you want to define custom paper size for Microsoft Print to PDF here is how to do. But actually you have to print on your ZDesigner_GK420d printer.
My bad. Installed PDFCreator, followed the instructions above using native print and setting the paper size to my custom form, and the paper_name and paper_data are in about:config are now as follows: print.printer_PDFCreator.print_paper_data = 121 print.printer_PDFCreator.print_paper_name; (empty string)
So it's not enought to call the method definePaperSizeData and I always have to create them in the windows settings? Why do I have to call the definePaperSizeData then?
I'm also struggling already several hours to get it working and it's really confusing...
I have a strange issue printing labels with a ZDesigner GK420d.
The following is my print code:
I'm running this on windows 10. Looking in my FF(50.0.2)'s about:config, i found the paper sizes for this printer, and entered them as a custom paper size. However, this is different from the actual size of the labels i am trying to print on, which are 100mm width x 150mm height. I have tried changing the above custom paper size to this, but it makes no difference to the actual print out.
When i print the image in portrait, it fits on one label but is very small, and when i set the paper orientation to landscape, the font is huge and prints on many labels. It's almost like it is having problems shrinking the image to fit.
Any suggestions on what else to try would be appreciated.