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

Safe path frustrations with insertPages

David Dunn
Registered: Oct 28 2010
Posts: 116
Answered

I have created a pdf that I will call ‘collector.pdf’ for the sake of discussion. Users of collector.pdf will input data that will be utilized in several other pdf files (I’ll call them ‘recipient.pdf’ files). I want to create scripts attached to collector.pdf buttons as mouse up actions, which scripts will insert my recipient.pdf files (one or more per script) in collector.pdf.
 
My objective is to enable users to enter their personal folder paths (where they will store the ‘recipient.pdf’ forms) (their paths would be stored in text fields in collector.pdf). My scripts would target the recipient.pdf forms in their folders, automating the process of inserting them into collector.pdf. To restate that, I want a script that will locate an existing, named file on the same computer and insert it at the end of collector.pdf. (I realize the users will need to designate their folders as trusted sites in their Preferences).
 
I’ve studied the JavaScript API and read about absolute paths and device independent paths and safe paths, and privileged vs. non-privileged context, and the trustedFunction method. Each time I think I’ve found a solution I hit another brick wall, e.g., methods that are only available during batch and console events (i.e., insertPages() ). Even though I have designated both the folder and the file in the following script as a trusted file and trusted site in my preferences, I cannot succeed in using insertPages() in this mouse up script:
 
this.insertPages ({
nPage: -1,
cPath: "/c/1Data/1MDF_Forms/k.pdf", //this is my trusted folder and trusted file
nStart: 0
});
 
When I execute this event, I receive this error message:
NotAllowedError: Security settings prevent access to this property or method.
 
Can someone point me in the right direction, to a means to accomplish my objective?

David D

My Product Information:
Acrobat Pro 9.4, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Accepted Answer
If the method can only be executed during batch and console events, and you're not running it from such an event, then the other limitations are irrelevant. You simply can't call this method.

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