Setting the printout using a script
Copy link to clipboard
Copied
Hello,
I have a problem with setting the printout using java script. I have a complicated form that is designed for an A4 landscape page. Finally, to print I use my own button with an appropriate script that decides what is visible and what is not. The problem is that when I trigger the printout, I get the print system window with this miniature preview and options. In this window, the print is on the portrait side and is slightly reduced. Pressing the "Size" button (you only need to press it without any parameter changes) causes that everything is then exactly as it should be and the page in the preview is landscape and in the correct magnification. And I am not able to get the same effect with the script.
Most of my forms have two buttons to trigger a printout. One, he prints the forms filled in on the computer and then I ask if, to save paper, print 2 pages on one. And the second one that prints the blank form for handwriting in the original size without any reduction. The code below is just a blank printout for manual filling.
In forms where pages are designed as portrait, everything works perfectly without shrinking and with shrinking and placing 2 pages on one with orientation change. In this case, unfortunately, I have a problem that I cannot deal with.
The script fragment responsible for executing the printout looks like this:
pp = this.getPrintParams();
pp.pageHandling = pp.constants.handling.nUp;
pp.nUpPageOrders = pp.constants.nUpPageOrders.Horizontal;
pp.nUpNumPagesH = 1;
pp.nUpNumPagesV = 1;
pp.nUpPageBorder=false;
pp.nUpAutoRotate=false;
pp.DuplexType = pp.constants.duplexTypes.DuplexFlipShortEdge;
this.print(pp);
And this is what it looks like in the pictures.
Copy link to clipboard
Copied
It seems you're using the Actual Size option. Why are you selecting the "nUp" option then? That's what's causing the Multiple button to be selected when the Print dialog is displayed.
Copy link to clipboard
Copied
With the "nUp" options it is from experience. Because with another button it is possible to print where I set:
pp.nUpNumPagesH = 1;
pp.nUpNumPagesV = 2;
Unfortunately, it was so that without using these options, the printout in the original size was not correct and required manual setting of parameters during the printout. It looked as if some parameters from the last script print job were being remembered. Later, the printout from a completely different program even turned out to be wrong. Therefore these parameters are set.

