Skip to main content
Participant
July 19, 2022
Answered

Get user's print params from the print dialog box with Javascript.

  • July 19, 2022
  • 2 replies
  • 824 views

I have created a print stamp that postions a date to the document when printing. Because the document contains different size pages, to make the postion of the print stamp consistent across all of the pages, I have used a  for loop to create print stamps accross all of the pages when the document is printed.

The problem is it slow to process the print request this way for large documents. The type of documents that will be printed are 100 to 300 page PDFs of which the user will most likely only be printing between 2 to 10 pages of their choice.

I want the script to make the print stamp only for the pages that the user selects in the print dialog box to save processing time in large documents. How can I get hold of these params using Javascript in Adobe Acrobat?

This topic has been closed for replies.
Correct answer try67

You can't. The only way to do that is to prompt the user to enter the page range they want to print before opening the Print dialog, then watermark those pages, and then open that dialog for them, and pre-populate the Pages field in it. This can only be done if they use a button you add to your file to print it. You can't do it if they use the built-in File - Print command, nor can you prevent them from changing that range, if they wanted to.

2 replies

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
July 19, 2022

You can't. The only way to do that is to prompt the user to enter the page range they want to print before opening the Print dialog, then watermark those pages, and then open that dialog for them, and pre-populate the Pages field in it. This can only be done if they use a button you add to your file to print it. You can't do it if they use the built-in File - Print command, nor can you prevent them from changing that range, if they wanted to.

Bernd Alheit
Community Expert
Community Expert
July 19, 2022

You can't read the parameters from the print dialog with Javascript.