Expand my Community achievements bar.

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
Former Community Member

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
Former Community Member

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

Former Community Member

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!

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----