Hi
I’m using a javascript (attached to a button) to loop through a tab-delimited text file, load in individual records to a pdf form, and then save these as individual pdfs. In order to do this, I had to define saveAs as a “trusted function” and save this to the javascripts folder of my Adobe program folder. Up to now it works fine.
My newest project has been to write VBA code in the Access application where the data actually resides to open the pdf. While I can get the pdf to open, the saveAs is not working. Any suggestions? (I've found some similar posts but haven't been able to glean the necessary information out of them)
Thanks,
Rich
This is the VBA:
Sub OpenAdobe()
Dim objAdobe As New Acrobat.AcroApp
Dim doc As New AcroAVDoc
objAdobe.Show
objAdobe.Maximize 1
doc.Open CurrentProject.Path & "\Vouchers\BatchVouchers10.pdf", "Vouchers"
End Sub
This is the (abbreviated) “trusted function”:
save = app.trustedFunction(
function(filename,type)
{
app.beginPriv();
if (type == "final") {
this.saveAs("Final/" + filename + ".pdf");
}
app.endPriv();
}
)
And this is the (abbreviated) relevant portion of the main javascript in the pdf:
switch(this.getField("Radio").value) {
case "Final":
save(filename,"final");
break;
}
Dim jso As Object
Set jso = doc.GetJSObject
jso.save()
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script