Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How do I create a PDF print button that only prints certain pages?

New Here ,
Dec 09, 2020 Dec 09, 2020

I am trying to create a custom print button on a PDF form that will print pages 2-4, SKIP page 5, and continue printing page 6-7.  Is this possible?  I am not very familiar with JavaScript and have tried looking at other post on this topic but I can not figure out how to not print page 5.

 

Any help would be apprecitated.  

TOPICS
Acrobat SDK and JavaScript
1.7K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 09, 2020 Dec 09, 2020

You can add this code to button: (keep in mind page 1 is 0, page 2 is 1, page 3 is 2...etc)

var x = this.getPrintParams();
x.printRange = [[1,3], [5,6]];
this.print(x);
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 09, 2020 Dec 09, 2020

Yes, this can be done using a script, like this:

 

 

var pp = this.getPrintParms();
pp.printRange = [[1,3], [5,6]];
this.print(pp);

Notice the page numbers are zero-based, so page 2 of the file is 1 in the script, page 6 is 7, etc.

 

Edit: Got the page numbers mixed up... Fixed now.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 09, 2020 Dec 09, 2020
LATEST

Thank you this worked.  I have been trying to figure this out all week.  

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines