I wrote an Illustrator script that draws shapes. The last step of the process is to save the a PDF of the doc to the desktop.
I managed to write a code that works correctly, but I cannot figure out how to get it to use a preexisting PDF Preset; it just uses the app default. Does anyone know how I can fix this? Also, this code seems a bit messy; is there a more straightforward way to write the code?
Thanks for your help!
//NAME OF PDF PRESET TO USE
var presetName = "My Preset";
var newFileName = "0000.pdf";
//NEW FILE PATH
var newFile = new File("~/Desktop/" + newFileName);
// USE FUNCTION TO SET PDF EXPORT OPTIONS
var saveOptions = this.getOptions();
app.activeDocument.saveAs(newFile, saveOptions);
function getOptions(){
// USE CUSTOM PDF EXPORT OPTIONS
var pdfSaveOpts = new PDFSaveOptions();
// CODE FOR PDF EXPORT OPTIONS
pdfSaveOpts.compatibility = PDFCompatibility.ACROBAT4;
pdfSaveOpts.viewAfterSaving = false;
return pdfSaveOpts;
}