Skip to main content
kehumphr
Inspiring
June 21, 2020
Answered

Print Button via Javascript with Acknowledgement Popup Box

  • June 21, 2020
  • 4 replies
  • 1314 views

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!

This topic has been closed for replies.
Correct answer kehumphr

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.

4 replies

Joel Geraci
Community Expert
Community Expert
June 22, 2020

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.

 

kehumphr
kehumphrAuthorCorrect answer
Inspiring
June 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.

try67
Community Expert
Community Expert
June 21, 2020

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.

kehumphr
kehumphrAuthor
Inspiring
June 22, 2020

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.

try67
Community Expert
Community Expert
June 22, 2020

I believe so, but you'll have to test it...

Legend
June 21, 2020

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.

kehumphr
kehumphrAuthor
Inspiring
June 22, 2020

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