Disabling Printing

Avatar

Avatar

rosepremo

Avatar

rosepremo

rosepremo

04-11-2011

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.

View Entire Topic

Avatar

Avatar

pguerett

Avatar

pguerett

pguerett

04-11-2011

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