Skip to main content
Participating Frequently
April 29, 2021
Question

Document action "will print". How to find out cancel printing because "did print" not executed?

  • April 29, 2021
  • 2 replies
  • 3773 views

Hello,

 

I use JS to set some fields, empty default values, check fields... when document action "will print" initiated. (hitting Print button)

After this i choose "print to PDF", so i have to select a file to save.
When saving of the file is finished, the document action "did print" executed as it should an call my js function => everything is ok.

My problem is: The document action "will print" allready executed, that is ok and should be. But if i cancel the printing (for example, if i abort saving print to PDF), the "did print" action not executed. So the form stock between "will print" and "did print". That is a problem.

In other PDF-viewer software, the action "did print" also executed, even if i cancle printing (saving to PDF file). Is this a bug or should it be, that "did print" not executed after abort saving file to pdf?

 

Thank you very much and best regards
vadaszaleb

This topic has been closed for replies.

2 replies

try67
Community Expert
Community Expert
May 4, 2021

Will Print only executes after the user clicks OK in the Print dialog, not before the dialog is shown. At that point they can only cancel the print command through the OS, which you can't detect using a script from within the file, and I don't think it will affect the Did Print event, either. It will probably get triggered as if the file was actually printed, even if it was not. So I don't think this is going to be possible.

Participating Frequently
May 4, 2021

Hello try67,

 

so ok, "did print" not executed, when the user cancel printing (for example not save print to pdf). But so the Document/form stuck between the already executed "will print" and "did print". I reset some fields in "did print", but "did print" never called after canceling for example saving file (print to pdf).

 

The problem ist, that other programs also execute "did print" when user cancel printing - so there are different procedures and "did print" is useless until it´s not work same in all viewers. I dont know, which PDF viewer the users use and the pdf have to work same in all.

 

I uploaded a simple form, you can test it (top line "Please fill out form" will changend by "will print" into "printing document". After this "did print" reset fields again). I try out with chrome, edge, foxit reader => all programs call "did print" after cancel saving print to file, just adobe reader not execute "did print". (or i did a mistake or missunderstood, let me know pls.)

 

Thank you

try67
Community Expert
Community Expert
May 4, 2021

I can't help you with it not working in other applications. You need to contact the developers of those applications and ask them to adjust their implementation.

Participating Frequently
May 4, 2021

Hello,

Obviously there is no solution - such elementary things like "will print" and "did print" are processed differently by Adobe and other programms (or i did a mistake). But it should work same.

Maybe there is an other solution to call a function pre printing to check some form elements in user defined functions?
Thank you.