Skip to main content
Participant
April 7, 2021
Question

How to reference the last page in a document with the "nEnd" parameter

  • April 7, 2021
  • 1 reply
  • 816 views

I'm working on writing a script that will silently print the 3rd page until the end. The reason being is that I constantly print bills and the first two pages are unnecessary for my printing purposes.

So far this is what I have.

this.print({bUI: false, nStart: 2, nEnd: 3, bSilent: true, bShrinkToFit: true});

The issue with this is this would only work for a 4 page document. My documents are anywhere from 3 pages to more than 4. (Varies, sometimes as much as 20.)

I need a way to reference generically, the last page, whatever the last page may be. For the nEnd parameter, is there a way to reference the last page in the current PDF?

Thanks,

-Y

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
This topic has been closed for replies.

1 reply

JR Boulay
Community Expert
Community Expert
April 7, 2021

Try this:

 

this.print({bUI: false, nStart: 2, nEnd: this.numPages - 1, bSilent: true, bShrinkToFit: true});

Acrobate du PDF, InDesigner et Photoshopographe