Using saveAs funtion with portfolios no longer working with Acrobat DC
Hi,
I need help using the saveAs funtion in a portfolio. My portfolio contains multipe pdf files and i use a protected funtion.
This funtion use to work as intended in acrobat 11. However since upgrading to acrobat DC the file no longer saves or reopens the file i am working on.
Basicly my protected funtion saves the original document, then saves the document as a tempory file and flattents it, then attaches it self to an email, then reopens the original document.
any help would be very much appreciated.
Running this.saveAs funtion through the console while working inside of a portfolio throws an error that the file is already open.
below is the code for my mouse up button
var docName = this.documentFileName;
var saveDirectoryFull = this.path;
var certNo = this.getField ("CertificateNo").value;
if (saveDirectoryFull.indexOf("|") > -1 ) {
saveDirectoryFull = saveDirectoryFull.replace ("|", "");
saveDirectoryFull = saveDirectoryFull.split ("|",1);
};
savecopyemail(saveDirectoryFull, docName, certNo);
below is my code for my trusted funtion
var savecopyemail = app.trustedFunction(function(saveDirectoryFull, docName, certNo){
app.beginPriv();
this.closeDoc();
var os = app.platform;
if (os = "WIN") {
var userdoc = app.getPath("user","documents");
var temporaryDirectory = userdoc.replace ("Documents", "AppData/Local/Temp");
};
if (os = "MAC") {
try{
var temporaryDirectory = app.getPath("user", "temp");}catch(e){}
};
var docNameStriped = docName.replace(".pdf", " ");
var tempDirFull = temporaryDirectory + "/" + docNameStriped + certNo + ".pdf" ;
reopen = app.openDoc(saveDirectoryFull);
reopen.saveAs ({cPath: saveDirectoryFull, bPromptToOverwrite: false});
this.flattenPages({nNonPrint: 2});
this.saveAs ({cPath: tempDirFull, bPromptToOverwrite: false});
this.submitForm({cURL:"mailto:?subject=",
cSubmitAs:"PDF"
});
this.closeDoc(true);
app.openDoc(saveDirectoryFull);
app.endPriv();
});
