Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Disabling Printing

Avatar

Level 2

I need to stop people from printing the form.  The whole purpose of having the electronic form is to save paper.  People are printing multiple copies and we don't want them to do it.  I may need the capability of printing at some point, so I tried a script I found in the forum...but it's not working.  Basically, I have a field that I want a specific value typed in, like a password.  If that is correct, they should be able to print the form. Here is the code I used:

form1.Page1.Password::prePrint - (JavaScript, client)

if (this.rawValue != "xxx333")

{

    app.alert("You cannot print this form. See Greg or Denise for questions.");

    xfa.event.cancelAction = true;

}

else

{

    xfa.host.print();

}

In this case, it will pop up the box telling them they can't print if they don't type xxx333 into the text field.  However, it still pops up the print box after that, so they can still print.  I was hoping the cancelAction script would take care of that, but it doesn't seem to do that. Is there a way to get this to work?

Thanks in advance,

Rose.

1 Accepted Solution

Avatar

Correct answer by
Level 10

I tried it on a form here and it worked fine ....are you expecting it to work after I enter th epassword? Rememeber that th euser has to invoke a print before one can be cancelled. I woudl remove the else portion .....there is no need to print again ..the user already hit print to start this process in the first place.

I included my sample .....the code is on the prePrint of the password field but you can put it on any prePrint event.

paul

View solution in original post

4 Replies

Avatar

Correct answer by
Level 10

I tried it on a form here and it worked fine ....are you expecting it to work after I enter th epassword? Rememeber that th euser has to invoke a print before one can be cancelled. I woudl remove the else portion .....there is no need to print again ..the user already hit print to start this process in the first place.

I included my sample .....the code is on the prePrint of the password field but you can put it on any prePrint event.

paul

Avatar

Level 2

It works on yours, but it doesn't work on mine. I have the same code on the prePrint event of the Password field.  Is there another setting/preference that I need to change to get this to work?

https://acrobat.com/#d=2XVjWYY1p1vxMVhRT1ZadA

Thanks in advance!

Rose.

Avatar

Level 10

I think there was a bug in version 8.1 that stopped the cancel print …if you up the target version to 9 it works. You can do that in File/Form Properties/Defaults and make the target version 9.0 and it will work.

Paul

Avatar

Level 2

Thanks so much...it works!  It's always the little things!