Skip to main content
j.massie
Participating Frequently
November 15, 2017
Answered

Why are global variables accessible from a different PDF?

  • November 15, 2017
  • 3 replies
  • 2356 views

Hi.

Can anyone please help.

When I set a Global Variable in Document 1, I can access this Global Variable in Document 2 if Document 1 is still open.

Why is this, I thought this was stopped by Adobe for Security Reasons?

Kind regards

Jon

This topic has been closed for replies.
Correct answer try67

That's the entire point of a global variable... Use a doc-level variable

instead.

3 replies

Thom Parker
Community Expert
Community Expert
November 15, 2017

There are two options if you want data to remain persistent with in a document context.

1. Write the data to a form field, that is what they are good for.

2. Write the data to the "info" object. This is the same as the data set on the "Custom" tab on the document properties dialog

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
November 15, 2017

That's the entire point of a global variable... Use a doc-level variable

instead.

Inspiring
November 15, 2017

It depends on how things are set up on the system the PDFs are being used on. For example: Edit > Preferences > JavaScript > Enable global object security policy

j.massie
j.massieAuthor
Participating Frequently
November 15, 2017

I have tried that setting and am still having the same issue.

Is there any other way to save a variable in a document that can be accessed in the future, without using the Global object. Or am I just using it wrong?

Thanks for the speedy reply, much appreciated.

Inspiring
November 15, 2017

The easiest way to save a value in a document is to set the value of a form field, which can be hidden or on a hidden template page. It's hard to say why you're having the problem you are without knowing exactly what you're doing.