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

New Here ,
Apr 29, 2021 Apr 29, 2021

Copy link to clipboard

Copied

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

TOPICS
PDF forms , Print

Views

1.2K

Likes

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
New Here ,
May 04, 2021 May 04, 2021

Copy link to clipboard

Copied

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.

Likes

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 ,
May 04, 2021 May 04, 2021

Copy link to clipboard

Copied

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.

Likes

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
New Here ,
May 04, 2021 May 04, 2021

Copy link to clipboard

Copied

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

Likes

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 ,
May 04, 2021 May 04, 2021

Copy link to clipboard

Copied

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.

Likes

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
New Here ,
May 04, 2021 May 04, 2021

Copy link to clipboard

Copied

hello,

 

i understand you of course - the others do their own way. But it is sad anyway, that such elementary function seems to be different.

Maybe there is an other solution not to stuck between "will print" and "did print" in pdf reader - i will look for it. I read something about prePrint checks, but dont know how it works.

 

thank you anyway that you tryed to help me.

greetings

Likes

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
LEGEND ,
May 04, 2021 May 04, 2021

Copy link to clipboard

Copied

Well, Adobe invented it, and implemented and documented it. Everyone else just copied. But the documentatoin does not make it clear what should happen, so this is not a bug, just a difference of choice. Not helpful, I know.

Likes

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
New Here ,
May 04, 2021 May 04, 2021

Copy link to clipboard

Copied

In all other PDF viewers, i have tested, i dont stuck betweend "will print" and "did print".
If you name this various functionality as a copy, that's fine.
Maybe i will create 2 versions of my PDF or delete my clean4printing function in my form, because i can not reset the form automaticly after canceling printing.
I will find a solution.
Thank you anyway

Likes

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
New Here ,
May 04, 2021 May 04, 2021

Copy link to clipboard

Copied

You are right. Adobe was first i also think and they do great job. And of course i cant ignore the huge amount of people with adobe viewer - so i have to find something works similar - in worst case as i wrote i have to delete some "will print" functions.

Likes

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
New Here ,
May 11, 2021 May 11, 2021

Copy link to clipboard

Copied

Hello,
some more information:
It looks like that it is a complex problem.
The form also works fine in Adobe reader, for example print as fax,....
It just have problems with the combination Adobe reader with printing as "Microsoft Print to PDF". After cancle the saving "Microsoft to PDF", the form stuck between "will print" and "did print", so "did print" not executed.
I just wanna tell this the community, it is interessting.

 

Is there a possibility to forbid printing via menu and toolbar - and set a functional print button with JS print() function. That would help me.


Greetings.

Likes

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 ,
May 11, 2021 May 11, 2021

Copy link to clipboard

Copied

You can't forbid this.

Likes

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
LEGEND ,
May 11, 2021 May 11, 2021

Copy link to clipboard

Copied

You cannot block any part of the user interface, except with security options. You can set document security to forbid printing, but then printing is completely impossible by any method in your code.

 

I think your testing of "other" PDF viewers may throw up many more inconsistencies. Many will not handle any JavaScript at all. Some may handle JavaScript but not events. All bets are off, because these are independent developers. 

 

You seek a level of control that is simply impossible in the real world. In general, printing is much more complex anyway: when printing "completes" it may just mean the work is queued; it could still fail. With some printer drivers the user could reprint, save the file, or change the printing methods. Where knowledge of printing is really important (for example in printing millions of dollars worth of cheques), complex systems with hardware communication are needed.

Likes

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
New Here ,
May 11, 2021 May 11, 2021

Copy link to clipboard

Copied

LATEST

Thank you "Test Screen Name" - you are right. that is really complex theme.

 

I think i will create a function that place a big layer over the form ,if there is a validation error. And the user have to click to remove this big overlayed layer to edit form. This click i can use to call my "did print" functions, if not executed. This should work in every pdf viewer.

 

greetings

Likes

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