Skip to main content
Participant
May 4, 2022
Answered

Javascript for printing form fields only

  • May 4, 2022
  • 2 replies
  • 1546 views

Howdy everyone!

I am making a PDF form that will allow us to print onto an already printed cardstock form. I need to have the form fields visible while we are filling in the form, but then I only want the form fields to print. I know there is an option to do this in the print menu, but I would like to be able to have a button on the PDF page that allows one click send to the printer. I currently have the below Javascript added to a button that allows the one-click-print, but need to figure out how to add the "print form fields only" as a Javascript...any ideas? Is this possible?

 

var pp = this.getPrintParams();pp.interactive = pp.constants.interactionLevel.automatic;pp.printerName = "THIS IS THE PRINTER NAME";this.print(pp);

This topic has been closed for replies.
Correct answer JR Boulay

Add this line:

 

var pp = this.getPrintParams();
pp.interactive = pp.constants.interactionLevel.automatic;
pp.printerName = "THIS IS THE PRINTER NAME";
pp.printContent = pp.constants.printContents.formFieldsOnly;
this.print(pp);

2 replies

JR Boulay
Community Expert
JR BoulayCommunity ExpertCorrect answer
Community Expert
May 4, 2022

Add this line:

 

var pp = this.getPrintParams();
pp.interactive = pp.constants.interactionLevel.automatic;
pp.printerName = "THIS IS THE PRINTER NAME";
pp.printContent = pp.constants.printContents.formFieldsOnly;
this.print(pp);

Acrobate du PDF, InDesigner et Photoshopographe
Participant
May 7, 2022

Perfect thank you so much!

Bernd Alheit
Community Expert
Community Expert
May 4, 2022

Use the property printContent for this. Details are in the Acrobat Javascript Reference.

Participant
May 7, 2022

Thank you!