Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Printing current page button LiveCycle


Level 1

Hi there everyone,


So I have noticed that people for a long time have been searching for a way to print only a specific page in a PDF with a button and there were no answers, until now (at least I have noticed that by doing Google searches, community searches so on). So I made a fix with a short line of code (in bold below). I use this button in an invoice book I made that is dynamic (additional pages and invoice lines so on....)


Here is the example:


JavaScript, Click event


var pp = event.target.getPrintParams();
pp.interactive = pp.constants.interactionLevel.automatic; // No user interaction
pp.printerName = "PDFLite"; // This is the PDF printer in this case which my form users are using to distill a protected XFA PDF to a high res image to email
pp.printAsImage = true; // Prints as an image (good for security - makes others unable to easily edit things)
pp.firstPage = xfa.host.currentPage; //This is the code to only print the current page
pp.lastPage = xfa.host.currentPage; // The second line which is necessary to make it work


Anyways, I hope this helps some people out.


- Adam

0 Replies