app.activeDocument.saveAs but without opening the saved file
I started learning JSX and made this basic save as PDF Script:
function saveAsPDF() {
var f = new Folder(app.activeDocument.path + "/" + app.activeDocument.name.split('.')[0]);
if ( ! f.exists ) {
f.create()
}
var pathBeforeSaving = app.activeDocument.path + "/" + app.activeDocument.name;
var pdfFile = new File(app.activeDocument.path + "/" + app.activeDocument.name.split('.')[0] + "/" + app.activeDocument.name.split('.')[0] + '.pdf');
var pdfOptions = new PDFSaveOptions();
pdfOptions.viewAfterSaving = false;
pdfOptions.pDFPreset = "[Impressão de alta qualidade]";
app.activeDocument.saveAs(pdfFile, pdfOptions, true);
alert("Saved");
app.activeDocument.close();
open(File(pathBeforeSaving));
}
saveAsPDF();
It saves a file in a folder with the same name of the life.
The Problems is that after saving the file, it replaces the current app.activeDocument to the new PDF file, but i still need to make chages into the original .ai file.
There is a way to save a new PDF file without opnening it after saving?
