Copy link to clipboard
Copied
Does any one have a script to export multiple PDFs at once from InDesign. So if I need to export a file with cropmarks and one without it, I can do so at once?
Any help is appreciated. Thanks!
Hello @Pablodp
You'll need to create\define the two PDF Export presets, one for the Marks named WithMarks and the other for no Marks named NoMarks. Then give the below code a try........
doc = app.activeDocument;
// Here you define the PDF Export preset
preset1 = app.pdfExportPresets.itemByName("WithMarks");
preset2 = app.pdfExportPresets.itemByName("NoMarks");
if (!(preset1.isValid && preset2.isValid)){
alert("One of the presets does not exist. Please check the spelling carefully.");
exit
...
Copy link to clipboard
Copied
Have a look here:
https://creativepro.com/files/kahrel/indesign/batch_convert.html
Copy link to clipboard
Copied
Hello @Pablodp
You'll need to create\define the two PDF Export presets, one for the Marks named WithMarks and the other for no Marks named NoMarks. Then give the below code a try........
doc = app.activeDocument;
// Here you define the PDF Export preset
preset1 = app.pdfExportPresets.itemByName("WithMarks");
preset2 = app.pdfExportPresets.itemByName("NoMarks");
if (!(preset1.isValid && preset2.isValid)){
alert("One of the presets does not exist. Please check the spelling carefully.");
exit();
}
if (doc.saved){
thePath = String(doc.fullName).replace(/\..+$/, "") + ".pdf";
thePath = String(new File(thePath).saveDlg());
}
else{
thePath = String((new File).saveDlg());
}
thePath = thePath.replace(/\.pdf$/, "");
withMarks = thePath + "_With_Marks.pdf";
NoMarks = thePath + "_No_Marks.pdf";
app.pdfExportPreferences.pageRange = PageRange.ALL_PAGES
doc.exportFile(ExportFormat.PDF_TYPE, new File(withMarks), false, preset1);
doc.exportFile(ExportFormat.PDF_TYPE, new File(NoMarks), false, preset2);
alert("Done Exporting PDF's!");
Regards,
Mike
Copy link to clipboard
Copied
Thanks, Mike. I'll give this a try.
Do you typically duplicate a current scrip in order to use the code above, or how do youinput this scrip onto a different script editor and then import? Sorry, still new to this. Thanks for your help.
Copy link to clipboard
Copied
Got to play with this and figured it out, Mike. Thnaks for the help! Works great.
Copy link to clipboard
Copied
Sorry to bug you again, Mike. Is there an easy way to adjust this for more presents? So, to export 3 PDFs instead of two, etc. Thanks, again.
Copy link to clipboard
Copied
Hello @Pablodp,
I'm glad you figured out how to save the code out as a .jsx file.
Re: Is there an easy way to adjust this for more presents? So, to export 3 PDFs instead of two, etc.
You'll need to create\define the third preset giving it a name
preset3 = app.pdfExportPresets.itemByName("My Third Preset");
Define the naming for the third PDF
myThirdPDF = thePath + "_AddToTheNameOfTheThirdPDF";
Then add the third export file for the third PDF for (myThirdPDF) and preset3.
doc.exportFile(ExportFormat.PDF_TYPE, new File(myThirdPDF), false, preset3);
Regards,
Mike