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

Create a button to print page range?

Participant ,
Dec 02, 2019 Dec 02, 2019

Copy link to clipboard

Copied

Hi

 

I need to create buttons that will print various ranges of pages in my document. that is, if someone wants to print out Chapter 3, there needs to be a button that, if clicked, prints just Chapter 3. I've done a bit of searching on the internet, and it seems like javascript is used for such tasks.

Unfortunately, I don't know javascript. I do see examples of scripts reported to cause Acrobat to print page ranges. But i don't know how to attach such scripts to a button. Is there a guide for beginners like me? In this case, I don't have time to learn javascript, I just need to implement it and change some variables (ie page ranges). Any thoughts?

Thanks in advance!

cheers,
kurt

TOPICS
Rich media and 3D

Views

1.3K

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
1 ACCEPTED SOLUTION
Community Expert ,
Dec 02, 2019 Dec 02, 2019

Copy link to clipboard

Copied

Yes, you have to use a script. It's not too complicated, though. Here's the basic code you need:

 

var firstPage = 10;
var lastPage = 15;
this.print({nStart: firstPage-1, nEnd: lastPage-1});

 

The code above will open the Print dialog with pages 10-15 pre-selected.

To attach it to a button field go to Prepare Form mode, right-click the button, select Properties, Actions, then create a new Mouse Up action with the "Run a JavaScript" command and paste the code into the editor window that will open. That's it.

View solution in original post

Votes

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 02, 2019 Dec 02, 2019

Copy link to clipboard

Copied

Yes, you have to use a script. It's not too complicated, though. Here's the basic code you need:

 

var firstPage = 10;
var lastPage = 15;
this.print({nStart: firstPage-1, nEnd: lastPage-1});

 

The code above will open the Print dialog with pages 10-15 pre-selected.

To attach it to a button field go to Prepare Form mode, right-click the button, select Properties, Actions, then create a new Mouse Up action with the "Run a JavaScript" command and paste the code into the editor window that will open. That's it.

Votes

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 Beginner ,
Jun 27, 2024 Jun 27, 2024

Copy link to clipboard

Copied

try67,  this is exactly what I was looking for. Thanks!!!

Votes

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 Beginner ,
Sep 23, 2024 Sep 23, 2024

Copy link to clipboard

Copied

Is there a modification I can add to include an additional, single page? ie. Print pages 5-9 PLUS page 23?

Votes

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 ,
Sep 24, 2024 Sep 24, 2024

Copy link to clipboard

Copied

That requires a more complex script. Try this:

 

var pp = this.getPrintParams();
pp.printRange = [[4,8], [22,22]];
this.print(pp);

Votes

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 Beginner ,
Sep 24, 2024 Sep 24, 2024

Copy link to clipboard

Copied

LATEST

Thank you again — perfect! And apologies for the extra work. . .I saw your response to the same question under "Javascript - Control Whether Page Prints?"

Votes

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