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

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

New Here ,
Dec 09, 2020 Dec 09, 2020

Copy link to clipboard

Copied

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

Views

471

Likes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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);

Likes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

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

Copy link to clipboard

Copied

LATEST

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

Likes

Translate

Translate

Report

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