I am trying to use one file (ScriptTest.pdf) to open a second file and save the second file as a new document.
Well, I got the opening of the document working. Thanks to thomp. (See my previously posted topic.)
Now, saving it to a new file is giving me problems. And this is where I am using the trustedFunction method.
In the config.js file I have:
myTrustedSaveAs = app.trustedFunction( function(adoc) { app.beginPriv(); var myTrustedRetn = adoc.saveAs({ cpath: "/C/Documents and Settings/jdawson/My Documents/Test/doc_ver8.pdf", bPromptToOverwrite: False }); app.endPriv(); return myTrustedRetn; } );
I added one line to ScriptTest.pdf to give:
//------------------------------------------------------------- //-----------------Do not edit the XML tags-------------------- //------------------------------------------------------------- //<Document-Level> //<ACRO_source>OpenEvent</ACRO_source> //<ACRO_script> /*********** belongs to: Document-Level:OpenEvent ***********/ app.alert({ nIcon: 2, nType: 0, cMsg: "You just opened this document.", cTitle: "OPEN EVENT" }); function OpenEvent() { } //</ACRO_script> //</Document-Level> //<Page-Actions> //<ACRO_source>Page1:Page Open:Action1</ACRO_source> //<ACRO_script> /*********** belongs to: Page-Actions:Page1:Page Open:Action1 ***********/ if(this.bAlreadyOpened == null) { var myDoc = app.openDoc("/C/Documents and Settings/jdawson/My Documents/Test/smalldocument.pdf"); //Added the one new line below var newDoc = myTrustedSaveAs(myDoc); this.bAlreadyOpened = true; } //</ACRO_script> //</Page-Actions>
When I open ScriptTest.pdf I get the alert (sort of a debugging aid for now) and then this error message comes up:
Acrobat JavaScript Debugger Functions Version 7.0
Acrobat Database Connectivity Built-in Functions Version 8.0
Acrobat EScript Built-in Functions Version 8.0
Acrobat Annotations / Collaboration Built-in Functions Version 8.0
Acrobat Annotations / Collaboration Built-in Wizard Functions Version 8.0
Acrobat Multimedia Version 8.0
Acrobat SOAP 8.0
adoc has no properties
5:Folder-Level:User:config.js
adoc has no properties
5:Folder-Level:User:config.js
The file smalldocument.pdf does open successfully, by the way.
Thanks again for the generous help.
It appears your function is expecting the object name of the second file you opened. "The call to your function should be like:
George Kaiser