• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

InDesign PDF Script

New Here ,
Jun 29, 2021 Jun 29, 2021

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! 

TOPICS
Print , Publish online , Scripting

Views

536

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Advisor , Jun 29, 2021 Jun 29, 2021

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
...

Votes

Translate

Translate
Community Expert ,
Jun 29, 2021 Jun 29, 2021

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Jun 29, 2021 Jun 29, 2021

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 07, 2021 Jul 07, 2021

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. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 07, 2021 Jul 07, 2021

Copy link to clipboard

Copied

Got to play with this and figured it out, Mike. Thnaks for the help! Works great. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 07, 2021 Jul 07, 2021

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. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Jul 07, 2021 Jul 07, 2021

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines