Issue scripting SaveAs PDF/X-4:2008
I have a script that is saving the current document with preset PDF/X-4:2008. It mostly works fine except we have found a specific file (about 49mb) that when saved with the script gets saved, it is about 759mb. I can replicate the behavior manually if using no preset and have "Preserve Illustrator Editing Capabilities" checked. In the script, I am setting PDFSaveOptions.preserveEditability to false. What am I missing? TIA
This is my script:
function savePrintFile() {
if (app.documents.length === 0) {
alert("No document open.");
return;
}
var doc = app.activeDocument;
// Open save dialog to name file and select location
var currentFile = new File(doc.fullName)
var saveFile = currentFile.saveDlg();
if (saveFile) {
// Save as PDF/X4
var saveOptions = new PDFSaveOptions();
//This string has to match a preset found in Adobe Illustrator. If the preset is not installed on the user's computer, this will fail the script
saveOptions.pDFPreset = '[PDF/X-4:2008]';
// Disable Illustrator editability
saveOptions.preserveEditability = false;
doc.saveAs(saveFile, saveOptions);
return saveFile;
}
}