Skip to main content
Inspiring
October 12, 2023
Answered

JavaScript Needed - Print Button with Custom Print Settings

  • October 12, 2023
  • 1 reply
  • 4117 views

Hi Smart People...

 

I have a document I need to add a PRINT TO PDF Button to for the team to use after filling in the form fields.  The document will be faxed and returned to us signed and sometimes has important info cut off due to the form running too close to the edges.  There are Visable but does not print fields on the document as well.

What I am thinking is I can create a PRINT TO PDF button the team can click that will print the document with a Custom Scale of 90% to the Adobe PDF printer.  I am assuming I will need to add a Mouse Up trigger to the button to Run a JavaScript to accomplish this.  Any chance someone can help me with the JavaScript?

This topic has been closed for replies.
Correct answer try67

perfect...  you're the best!  Ill give it a shot.  Any chance you know if I can make the print button still to print to Adobe PDF, even if I can't choose 90% scale?


You can, but you can't specify the file-name. The user will have to do that manually.

You can use something like this for that:

 

var pp = this.getPrintParams();
pp.printerName = "Adobe PDF";
pp.pageHandling = pp.constants.handling.fit;
this.print(pp);

1 reply

try67
Community Expert
Community Expert
October 12, 2023

You can't set the Scale to an exact percentage using a script. You can set it to the Fit option, which will mean all the document's contents will be scaled to fit on the page. But why are you printing to the Adobe PDF printer? Why not print it directly to the physical printer?

Inspiring
October 12, 2023

Hello Try67.  I am asking the team to print to PDF so they can fax out using eFax without the "Visable but doesn't print" fields showing on the document.  They can print to Adobe PDF to save the document on their desktop without those fields before sending to the recipient.

try67
Community Expert
Community Expert
October 12, 2023

There are much easier ways to do that. You can use a script to change those fields to hidden, then flatten the form fields, for example.