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

Print Button via Javascript with Acknowledgement Popup Box

Explorer ,
Jun 21, 2020 Jun 21, 2020

Copy link to clipboard

Copied

Good morning! I am creating a PDF document that will be fillable through Reader, and there will be several buttons that are programmed with JavaScript to send the document to a different printer depending on the need. My goal is to create a quick way to send these documents with one or two clicks, and no involvement from the user on which printer they need to choose.

 

This code in brackets [var pp = this.getPrintParams();pp.interactive = pp.constants.interactionLevel.automatic;pp.printerName = "PRINTER NAME";this.print(pp);] works great for sending it to the specified printer, I just make a quick modification to the printer name and VOILA! However, there is no feedback to the user that the document did indeed print. It would be nice to have that feedback before they clear the form and start on the next task.

 

So my question is this: is there a way to have the above code run, then to run another code that pops up a simple "Hey, that thing printed correctly!" after confirming it did indeed print? Is this possible with JS? Thank you in advance for your help!

TOPICS
Acrobat SDK and JavaScript

Views

654

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

correct answers 1 Correct answer

Explorer , Jun 22, 2020 Jun 22, 2020

Thank you to those that answered. I ended up just adding a second set of javascript that runs just before the print command. This fills in a date box I already needed with the date and time the button was hit, then prints the document.

Votes

Translate

Translate
LEGEND ,
Jun 21, 2020 Jun 21, 2020

Copy link to clipboard

Copied

It's not possible to confirm it actually did print (put it on paper), not even in theory. Printers often get on with their work entirely independently of the computer, and if they lose it the computer never knows.

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
Explorer ,
Jun 22, 2020 Jun 22, 2020

Copy link to clipboard

Copied

I guess a better way of phrasing this would be to get a confirmation that it was sent to the printer sucessfully?

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 ,
Jun 21, 2020 Jun 21, 2020

Copy link to clipboard

Copied

The only thing you can do is put a try-catch clause around the print command, and then display an error message in case one happened, but it's not guaranteed that if there was no error the file was actually printed.

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
Explorer ,
Jun 22, 2020 Jun 22, 2020

Copy link to clipboard

Copied

Would a command like this confirm if it was sent to the printer at least? I guess that is all I really want to know...that the document did it's job and just sent to the printer.

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 ,
Jun 22, 2020 Jun 22, 2020

Copy link to clipboard

Copied

I believe so, but you'll have to test 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
Explorer ,
Jun 22, 2020 Jun 22, 2020

Copy link to clipboard

Copied

Thank you to those that answered. I ended up just adding a second set of javascript that runs just before the print command. This fills in a date box I already needed with the date and time the button was hit, then prints the document.

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 ,
Jun 22, 2020 Jun 22, 2020

Copy link to clipboard

Copied

LATEST

Acrobat has a document "Did Print" event that you can attach some JavaScript to. It will run when the job makes it into the print queue... it doesn't guarantee that it makes it to paper. Look in JavaScript / Document Actions.

 

Screen Shot 2020-06-22 at 8.02.29 AM.png

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