Copy link to clipboard
Copied
I made a PDF form with Acrobat XI that should show/hide layers using JS depending on if the user checks or unchecks a checkbox.
At first sight it worked fine either on Acrobat Pro as well Reader DC.
I tested it with Reader X (2010) and it worked but didn't allow me to save the changes -- that make it totally pointless to me
My boss tested it on a different early Reader (don't know the version) and it didn't work at all. In his case the worse part is that it didn't tell that there was something wrong neither ask for an upgrade. It just didn't work.
There is a way to control this?
You can try Reader-enabling the files, but that's about it. The simple solution is to upgrade to a newer version of Reader...
Copy link to clipboard
Copied
You can try Reader-enabling the files, but that's about it. The simple solution is to upgrade to a newer version of Reader...
Copy link to clipboard
Copied
Thanks for the heads up, try67!
I tried the Reader enabled option and now it allowed me to save the changes in the form. As mentioned I tried it in Reader X and everything worked perfectly to me. IMO it's more than I would expect using an 8-years old version.
I still don't know what version my boss used and that didn't work. I am really curious about this but probably is something still older.
I fully agree with you that an upgrade is mandatory, however I still think that Reader should pop up an alert when the opened PDF brings a non-supported feature rather than just ignore it as everything was fine. It causes me a certain level of "insecurity".
Copy link to clipboard
Copied
You can have your script look at the app.viewerVersion property and branch your code accordingly. You can even pop up an alert if the version is too low.
J-
Copy link to clipboard
Copied
As far as I know I would have to embed the script to do that at document-level, that's right? I stayed looking for how to do in Acrobat XI that but couldn't find. Any clue?
Copy link to clipboard
Copied
It's in the JavaScripts tool set.
Copy link to clipboard
Copied
Do you have Acrobat XI Standard or Pro? Only the latter gives you direct access to the doc-level scripts UI, but you can still do it using a script if you have the Standard version.
Copy link to clipboard
Copied
Mine is Acrobat XI Pro but I have no idea where to put it. There is an 'Action Wizard' under tools but the only thing it allows me is to create actions (that includes JS) to be added as 'tools' in the toolbar. I think I need something that I could force to be executed as soon the PDF be opened and I have no idea where it should be put...
Copy link to clipboard
Copied
It's under Tools - JavaScript - Document JavaScripts...
Copy link to clipboard
Copied
Ah! I finally found it (it was hidden). Thank you!
However now the 'Document Javascript' option is there but greyed out... any idea?
Copy link to clipboard
Copied
You have to do it before you Reader-enable the file...
Copy link to clipboard
Copied
Thank you very much for your HUGE patience! I am almost there. I already was able to write an action (actually a function) and make it run when a document 'event' happens. However, I have available only the following 'events':
I need something like 'Document Did Open'. There is a way of add it or I have to be happy only with the options above?
Copy link to clipboard
Copied
Use the Document JavaScripts window to add code that is executed when the file is opened.
Copy link to clipboard
Copied
I did that indeed! Let me show you step by step...
First I opened "Document Javascript" and set my custom function there. I made a simple one with an alert popup and called it "InitialCheck":
Then I opened "Set Document Actions" and attached my action to one of the available document events for testing. This way:
Then I saved the document and opened it with my old Reader X and when I tried to close it I got the popup meaning that it is working:
The problem is that in the "Document Actions" list I only have these options:
Document Will Close
Document Will Save
Document Did Save
Document Will Print
Document Did Print
But I don't have any "Document Did Open" that's what I really need... What am I missing here?
Copy link to clipboard
Copied
If you want the code in the function to be executed when the file is opened then add a call to it after the function definition.
Copy link to clipboard
Copied
Cool, thank you very much one more time! It worked exactly as I need!
A final couple of questions:
1) There is a way to force application close if the requisite doesn't match?
2) Would you point me the documentation where I can find the JS app methods I can use, etc?
Thank you very much again for your time and knowledge!
Copy link to clipboard
Copied
1) No. You can close the file, though.
2) Adobe - Acrobat Developer Center | Adobe Developer Connection
Copy link to clipboard
Copied
Thank you for everything! I am on my way now! Cheers!