These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Caching user preference data in pdf?

adoacr
Registered: May 4 2011
Posts: 41
Answered

Hi,
 
if a user fills in some envirronment preference data in a form, is it possible to cache it to the pdf as environment variables to use later to set preferences when the user next views the pdf? How does one go about this? Thanks

George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1875
There are a number of ways you can store data in a document, including form fields and custom properties (doc.info). You just need to read them when the document is opened.

You can also use globally persistent variables: http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.773.php

The particulars (e.g., how much storage space is available) seem to change all the time, so it's not advised to use it for anything critical.
try67
Expert
Registered: Oct 30 2008
Posts: 2398
If the user is using Reader, then you must enable the Extended Reader Rights in Acrobat for them to be able to save the PDF with the data in the form fields.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

Merlin
Acrobat 9ExpertTeam
Registered: Mar 1 2006
Posts: 766
Accepted Answer
George_Johnson wrote:
You can also use globally persistent variables
Beware: http://acrobatusers.com/forum/javascript/javascript-changes-1011
adoacr
Registered: May 4 2011
Posts: 41
I dont need to store the data in the form fields itself (as in the filled-in field to display again). just the information to use as user preference information. Do I need to have a rights-extended pdf for that? Couldnt quite get the warning about globally persistent variables above. does it just mean that we need to define our own 'temp' folder for app.getPath?

try67
Expert
Registered: Oct 30 2008
Posts: 2398
Maybe we misunderstood you... Do you mean that you want to store the application's preferences (those that can be set under Edit - Preferences) in a PDF so that when a user opens it, those preferences will be applies?
If so, there's only a very small number of preferences that can be set in that way, and it's usually frowned upon to use them since you're basically overriding the user's preferences without their consent.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

adoacr
Registered: May 4 2011
Posts: 41
so does that mean that if I set a global variable like global.setPersistent("myWeight",true), even if it is stored as a key value pair or in a js file (depending on wether the user has reader 8,9 or 10), will the data still be available to him the next time he opens the same pdf?
adoacr
Registered: May 4 2011
Posts: 41
no, setting the users reader software preferences was not what I mean. I was talking about setting environment/global variables like global.setPersistent("myWeight",true). looks like the only thing that has really changed with it is the way it is implemented, but the functionality is there. so, Im thinking it will suffice for my purposes..Will try it and get back to you.
Thanks