Copy link to clipboard
Copied
I use this Javascript to save Illustrator files to PDF. How can I tweak it to work with InDesign? "var dest" is a variable supplied by Keyboard Maestro, a macro builder for Mac.
// save as
var dest = "%Variable%DND_SaveLocal%/%Variable%proofName%";
saveFileToPDF(dest);
function saveFileToPDF (dest) {
var doc = app.activeDocument;
if ( app.documents.length > 0 ) {
var saveName = new File ( dest );
saveOpts = new PDFSaveOptions();
saveOpts.pDFPreset = "[Illustrator Default]";
//~ alert(saveName);
doc.saveAs( saveName, saveOpts );
}
}
Thank you for your help.
Lets take var dest as the path of the pdf that you wanna export, so the following code should work for you
...var dest = "Path to you pdf that is to be exported"
saveFileToPDF(dest);
function saveFileToPDF (dest) {
var doc = app.activeDocument;
if ( app.documents.length > 0 ) {
var saveName = new File ( dest );
var pdfPreset = app.pdfExportPresets.itemByName("[Illustrator Default]")
if(!pdfPreset.isValid)
{
alert("Preset not found")
exit(
Copy link to clipboard
Copied
Lets take var dest as the path of the pdf that you wanna export, so the following code should work for you
var dest = "Path to you pdf that is to be exported"
saveFileToPDF(dest);
function saveFileToPDF (dest) {
var doc = app.activeDocument;
if ( app.documents.length > 0 ) {
var saveName = new File ( dest );
var pdfPreset = app.pdfExportPresets.itemByName("[Illustrator Default]")
if(!pdfPreset.isValid)
{
alert("Preset not found")
exit()
}
app.activeDocument.exportFile(ExportFormat.PDF_TYPE, saveName, false, pdfPreset)
}
}
-Manan
Copy link to clipboard
Copied
Thank you! I'll give it a try.