Expand my Community achievements bar.

Limit the amount of copies that can be printed

Avatar

Level 4

Is there a way to limit the number of copies that can be printed of a pdf from inside the form in LiveCycle? I would like clients to only be able to print  only two copies of a form with Adobe Reader. How can I do this?

3 Replies

Avatar

Level 4

This should be doable, but not very pretty...

First, put a text-field on the form, and make it hidden with a defaullt value of 0;

in pre-print, check if the value of the hidden field is >= the limit, if so set

xfa.event.cancelAction = 1

that will prevent the print dialog from even showing.

if the value of the hidden field is < the limit, add one to the value of the field.

That should do it. If you need a hand with the actual code, just let me know.

- Scott

(limitations: if the user doesn't save the changes, the hidden field will remain at 0... as such, you may have to script the docClose event to trigger a save. The issue with this is that the user will be stuck with any changes made, regardless of whether they want to keep changes.. Like I said, it's not pretty. You could go one step further and save the state of all fields on open/save, then restore those values on close, except for the hidden field before triggering a save... As you can see, this can get complicated fast....)

Avatar

Level 4

Thank you for that solutution. I am going to try it tomorrow and see if it works. If I need help with the scripting, I'll let you know, which I probably will because I haven't had any training in writing script. Thanks again.

> Date: Thu, 4 Aug 2011 14:03:57 -0600

From: forums@adobe.com

To: jeanetteeichhorn@hotmail.com

Subject: Limit the amount of copies that can be printed

This should be doable, but not very pretty...

First, put a text-field on the form, and make it hidden with a defaullt value of 0;

in pre-print, check if the value of the hidden field is >= the limit, if so set

xfa.event.cancelAction = 1

that will prevent the print dialog from even showing.

if the value of the hidden field is < the limit, add one to the value of the field.

That should do it. If you need a hand with the actual code, just let me know.

- Scott

(limitations: if the user doesn't save the changes, the hidden field will remain at 0... as such, you may have to script the docClose event to trigger a save. The issue with this is that the user will be stuck with any changes made, regardless of whether they want to keep changes.. Like I said, it's not pretty. You could go one step further and save the state of all fields on open/save, then restore those values on close, except for the hidden field before triggering a save... As you can see, this can get complicated fast....)

>

Avatar

Level 4

Yet another issue that just popped into my mind is that the preprint event fires even when the print dialog is canceled. If your users cancel printing twice, they won't be able to print the form at all.

I don't personally know of any way to check if the print dialog was canceled. Even moving the +1 to the count to the postprint event wouldn't fix it, as the postprint event also fires regardless of whether the print dialog was cancelled.

If there is some script that can be used to check the print status (cancelled, etc.) then you could use the postprint event to decrement the counter if it was cancelled... but a quick look online hasn't turned up any sample script to check print status.

I'll have to step aside for now and hope someone else out there can help you with this particular hurdle.

Sorry to constantly bring bad news,

- Scott