Trying to achieve a crude, but easy to understand, folder-level script that can open a PDF, watermark it, and save it with the person's name within the file name. I'm spelling out the paths for simplicity. The is be temporarily placed in the local path folder to run on Acrobat startup. I can't seem to put together all of the concepts (like trusted functions) needed to make something that actually works. Assuming I'm even approaching this correctly, a working example would seem like it would be helpful to many beginners (like me!). I'd appreciate advice; I'm sure I'm starting with many mistakes.
// Test Doc.pdf has already been set with this.disclosed = true using batch processing.
//
var someName = "Joe Smith"; // name to be used in both filename and for watermark;
var mySaveAs = app.trustedFunction(
function(cpath)
{
app.beginPriv();
this.saveAs(cpath);
app.endPriv();
}
);
app.openDoc("/c/Documents and Settings/LoginMe2/My Documents/MyFolder/Test Doc.pdf");
// Add watermark, reset disclosure, save with new name. Original to remain unchanged;
this.addWatermarkFromText({
cText: someName,
nFontSize: 48,
aColor: [ "G" ,0.8 ],
bOnTop: false,
nRotation: 45
});
this.disclosed = false;
this.mySaveAs("/c/Documents and Settings/LoginMe2/My Documents/MyFolder/Test Doc " + someName + ".pdf");
this.closeDoc(); // close the personalized copy;
// This script is brute force, so repeat many times with different individual names;
Also, I spot at least one mistake in your script: You try to launch mySaveAs as method of the "this" object. You should just call it by itself, like so:
mySaveAs("/c/Documents and Settings/LoginMe2/My Documents/MyFolder/Test Doc " + someName + ".pdf");
- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com