Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Keep user from printing and seeing certain pages

Avatar

Former Community Member

Here's the scenerio:

The form has 4 pages.  I only want the user to see and know about page 1.

I need to batch print from the other 3 pages, each page in a seperate batch

Here's what I tried and the resulting issue:

1. Format pages 2,3,4 as visible print only

     a. the user can tell there are 3 other pages -they show up blank

     b. the user can see them if they decide to print

2. Format pages 2,3,4 as visible print only and restrict printing for the user

     a. I can't print without opening each one with a password - doesn't work well with batch-by-page printing

3. Format pages 2,3,4 as hidden - the user can't tell or see the other 3 pages but:

     a. I can't print the pages

3. Format pages 2,3,4 as hidden and have the form submitted as xml and import them into the full PDF

     a. there are fields that are dyamically changed based on user selection (ie. font selection), so the xml import doesn't work for that

Any ideas on how to "get my cake and eat it too"

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

You could try a hidden field which looks for the user's "name".

There are security issues and the script has to be in a trusted function. You can do this be placing a Javascript file inside the Acrobat folder. The trouble generally with trusted fuctions is that you have to send each user a copy of the js file and they have to also put it in the correct folder.

In your case this is not a problem, because you only want the js file on your computer and do not need to distribute it to others.

When you put this file (uploaded) in Acrobat / Javascript folder, Acrobat will automatically load it.

23-08-2009 07-17-08.png

In Acrobat make sure you have set a "Name" in Edit / Preferences / Identity tab:

23-08-2009 07-20-40.png

When you open the PDF, your user name will be in the field. This will only happen if the js file is loaded in the correct folder of the computer you are using.

23-08-2009 07-28-23.png

Once that is working, it is a simple step to include an if statement in the textfield, after the script that is in the initialize event:

if (this.rawValue == "lfalke") // or whatever your user name is set to...

{

     page2.presence = "visible";

     page3.presence = "visible";

     page4.presence = "visible";

}

else

{

     page2.presence = "hidden";

     page3.presence = "hidden";

     page4.presence = "hidden";

}

This would mean that the visibility of the three pages would be automatic. User with the js file AND your user name could see pages 2-4, everyone else would not see these pages.

I know it is a bit convoluted, but once set up it should continue to work OK.

Hope that helps,

Niall

View solution in original post

14 Replies

Avatar

Former Community Member

So this is really a one page form and you have 4 different data records for that form?

When they print you want the 4 records printed on the same single page...right?

Paul

Avatar

Level 2

From what I think you may want to do you should start with pages 2,3,4 hidden.  This is all the user would see. You could use password verification to change the pages to visible. If you don't want to do this for each document since it could be a lot may the form could look for the password in a file that would only reside locally.  Since the user would not have access to this file, no printing could occur.

Good luck.

Avatar

Former Community Member

Not really. There are 3 seperate obejcts that the user fills out on Page 1    Each of the other pages (2-4) has one of the 3 objects on them reformatted to size and position for a print job that places them on 3 seperate pages of different sizes. Since I print for multiple submissions with each page on a different sized paper, I need to batch print each page from the submissions at a time.

Does this clarify?

thanks.

Les

Avatar

Former Community Member

I love this idea.  How do I 1. set up password verification to unhide and 2. How would it get the password locally?

Thanks..

Avatar

Level 2

If you are familiar with xml you can place the password in a file and load in to the document.

<root>
  <password>privateWord</password>
</root>

http://livedocs.adobe.com/livecycle/8.2/acrobat_designer/wwhelp/wwhimpl/common/html/wwhelp.htm?conte...

set the password to a variable

vPassword = [xpath commands]

http://livedocs.adobe.com/livecycle/es/wb_help/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Workben...

Then in javascript:

if(vPassword=="privateWord") {

     page2Object.presence = "visible";

     page3Object.presence = "visible";

     page4Object.presence = "visible";

}

Some more elegant methods might be to use the XML as configuration file that would have default in doc that is overridden if a local file is found.

[orignal]

<root>
  <printpages>
     <page1>Yes</page1>
     <page2>No</page1>
     <page3>No</page1>
     <page4>No</page1>
  </printpages>
</root>

[new - avaiable only locally]

<root>
  <printpages>
     <page1>Yes</page1>
     <page2>Yes</page1>
     <page3>Yes</page1>
     <page4>Yes</page1>
  </printpages>
</root>

It may even be possible us the xml load to replace the portion of the document that sets the presence of the object you want to print.  Sorry I don't know where that is at the moment.

Avatar

Former Community Member

Thank you for this.  Unfortunately, I have never worked with XML

I was trying to learn using this example, uses something like this.?

Thanks..

Avatar

Level 7

To get the effect you want and still allow the user to print page 1, I would set up 2 print buttons. One that's obvious (for the user) which is set to only print page 1 and another which is disguised as regular text ( for you). You'd need to set pages 2, 3 and 4 to hidden and then on the disguised print button you can set pages 2, 3 and 4 to visible using a script. I've attached a simplified sample. On the sample I've made the hidden print button very large to make it obvious, but in reality you could set it up so that a single letter in the header is the print button. It's not very eloquent, but it works.

Avatar

Former Community Member

Thank you.  I did that yesterday for a very short term solution.  I still need the objects to become visible when on my machine without my interaction.

Again, thanks.

Avatar

Former Community Member

I tried this myself and can't get it to work.  I attached a simple form with the code you advised on.  Can you let me know what I am doing wrong?  Thanks.

Avatar

Correct answer by
Level 10

Hi,

You could try a hidden field which looks for the user's "name".

There are security issues and the script has to be in a trusted function. You can do this be placing a Javascript file inside the Acrobat folder. The trouble generally with trusted fuctions is that you have to send each user a copy of the js file and they have to also put it in the correct folder.

In your case this is not a problem, because you only want the js file on your computer and do not need to distribute it to others.

When you put this file (uploaded) in Acrobat / Javascript folder, Acrobat will automatically load it.

23-08-2009 07-17-08.png

In Acrobat make sure you have set a "Name" in Edit / Preferences / Identity tab:

23-08-2009 07-20-40.png

When you open the PDF, your user name will be in the field. This will only happen if the js file is loaded in the correct folder of the computer you are using.

23-08-2009 07-28-23.png

Once that is working, it is a simple step to include an if statement in the textfield, after the script that is in the initialize event:

if (this.rawValue == "lfalke") // or whatever your user name is set to...

{

     page2.presence = "visible";

     page3.presence = "visible";

     page4.presence = "visible";

}

else

{

     page2.presence = "hidden";

     page3.presence = "hidden";

     page4.presence = "hidden";

}

This would mean that the visibility of the three pages would be automatic. User with the js file AND your user name could see pages 2-4, everyone else would not see these pages.

I know it is a bit convoluted, but once set up it should continue to work OK.

Hope that helps,

Niall

Avatar

Former Community Member

That worked perfectly.  thank you so much!!!!!

Avatar

Former Community Member

Niall, Running into a small issue - if I save the document with Reader extensions from Acrobat  while my identity is set to the one in the script, anyone from any computer can then see all the pages. I have to change my identity in Acrobat first, then save with Reader Exentions.  In order to then see the pages on m y computer, I have to set my identiy back to match the script. Any ideas on how to avoid this?

Avatar

Level 10

Hi,

Try unhiding the field, and see what the script/trusted function is returning after the Reader Enabled form is opened (on yours and other PCs). This will guide you as to how to amend the if statement.

N.

Avatar

Level 10

OK, I am back in the office. I have enabled the form through Acrobat and I am seeing the same issue. For some reason Acrobat locks in the user's credentials/identity into the form when it is enabled. I suspect that this wouldn't happen if the form was enabled using LC Enterprise Suite Reader Extensions. Maybe this behaviour is hardwired into Acrobat so that the person who Reader Enabled the form through Acrobat can subsequently be identified.

When I was using the trusted function to get the user name, it was for a non-enabled form (using a database), so I didn't run into the problem.

I can't see a way round this at the moment. It depends on the number of forms you have to do. While awkward, it may work in the short term to change the user name while enabling and then change it back.

Sorry I can't be of more help!

Regards,

Niall