Hello,
I am using a plugin called automailmerge created by evermap. It's fairly straight forward as far as filling in fields, sending an email, etc. Where I am stuck is at the javascript part. It offers you to run javascript code before or after the mail merge is run. Basically all I want to do is attach a pdf to each mail merged document. Ideally the pdf to attach would be chosen by the number of the purchase order (ex. 12004.pdf), but one thing at a time. I am getting notallowederror when trying to run:
this.insertPages({nPage:this.numPages-1,
cPath:"PO12004.pdf"});
In the console this works fine, and adds the pdf to the end of the document. However, when I use that code in the plugin, I recieve a notallowederror. I have tried to use a trustedfuction, with no success. I even added the code below to the config.js file that I've seen on this forum and others.
var insertPO = app.trustedFunction( function (cPath)
{
app.beginPriv();
this.insertPages({nPage:this.numPages-1,
cPath:"PO12004.pdf"});
app.endPriv();
}
);
Do any of you have any ideas on how to get this code to run in a plugin? Or do you have any suggestions on what I should use to do a automated mail merge?
Thanks for your time,
Tim
There is a potential problem with your code. The cPath parameter in the insertPages call should be the full path to the file. If Acrobat does not find the file it will throw a security exception. Rather unhelpful, but that's Acrobat.
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script