I am trying to build a utility that will
(a) open a connection to a one-table database;
(b) loop through all the rows of data, performing the following on each row:
(i) store a column of data into a variable called 'controlID'
(ii) open a document called 'source.pdf',
(iii) write a footer into 'source.pdf' containing 'controlID'
(iv) save 'source.pdf' as '[controlID].pdf' to a different directory
(v) close '[controlID].pdf'
I had no problem getting the database part working, but am running into a stubborn error when attempting to invoke either 'saveAs' or 'closeDoc'. Setting the database stuff to the side, I wrote the following one-line script to troubleshoot the problem:
var source = app.openDoc("/C/source.pdf");
This causes the file to open, but if I add either or both of these:
source.saveAs("/C/output.pdf");
source.closeDoc(true);
Then a dialog box appears with the following message:
"Do you really want to execute the script: App:Init?
Executing it could interfere with the debugging session currently under way."
Clicking either 'Yes' or 'No' results in a fatal error - Acrobat crashes. I have searched for this message and can't find anyone with the same problem.
By the way, I associated the above script with a 'page open' action. I've also tried running it from within a separate .js file that runs every time i start up acrobat.exe and get the same result.
Would appreciate your help here!
When testing, you might want to try saving to your documents folder, as opposed to the root directory, which should not be allowed.