Hi,
I have a PDF when in i need to add run a javascript which combines 1 or 2 other PDFs
So i added script on the button
var newDoc = app.newDoc();
// Insert doc1.pdf:
newDoc.insertPages({
nPage: -1,
cPath: "/c/temp/doc1.pdf",
});
// Insert doc2.pdf:
newDoc.insertPages({
nPage: newDoc.numPages-1,
cPath: "/c/temp/doc2.pdf",
});
// Save the new document:
newDoc.saveAs({
cPath: "/c/temp/myNewDoc.pdf";
});
When clicked getting error that security settings prevent access to method or property
So i searched abt the error and found that this code has to be in batch or run in console or has to be in config.js file
So i added the code in as a Trusted Function and attached event to the button which calls that trusted function
But checking the debugger found that even if added my function as trusted and modified that config.js file it gives message in console that myTrustedFunction is not defined
Please help with any clue!!!
Thanks & Regards
nit
Second, you can't define a trusted function in a PDF Script.
Third, none of the operations you've shown above can be done in Acrobat Reader. They can only be done in Acrobat Professional or Standard.
Read this article:
http://www.acrobatusers.com/tutorials/2008/10/using_trusted_functions
And this one:
http://www.acrobatusers.com/tutorials/2006/folder_level_scripts/
And this one has an example of creating an Acrobat toolbar button using a trusted function:
http://www.acrobatusers.com/tutorials/2007/10/apply_security_with_js
Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]
The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script