Skip to main content
Inspiring
December 2, 2019
Answered

Create a button to print page range?

  • December 2, 2019
  • 1 reply
  • 2125 views

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

This topic has been closed for replies.
Correct answer try67

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.

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
December 2, 2019

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.

Martrese-KinderCare
Participating Frequently
June 27, 2024

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