Script for exporting InDesign doc as eps and pdf files simultaneously?

Community Beginner ,
May 27, 2022 May 27, 2022

Copy link to clipboard

Copied

Hello!

 

I'm looking to create or alter a script that will export an InDesign document to both an eps and pdf file in one action. For example, upon executing the script the export would result in two separate folders, one with all pdf's and one with all of the eps files. 

 

I've played around with the batch convert script created by Peter Kahrel, and I reached out to him, but it's not possible to alter his script to perform this action. 

 

I appreciate any and all insight/help!

TOPICS
How to , Scripting

Views

155

Likes

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
Adobe Community Professional ,
May 27, 2022 May 27, 2022

Copy link to clipboard

Copied

Just curious: What is your purpose for exporting pages as EPS?  It's not a good format for a contemporary workflow.

Likes

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
Community Beginner ,
May 27, 2022 May 27, 2022

Copy link to clipboard

Copied

Good question. Unfortunately, it's a requirement from the printer that my employer is using. 

Likes

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
Adobe Community Professional ,
May 27, 2022 May 27, 2022

Copy link to clipboard

Copied

They definitely need a RIP upgrade 😉

Likes

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
Advocate ,
May 27, 2022 May 27, 2022

Copy link to clipboard

Copied

Hello @kellie.rock29,

 

what would be the required export preferences for both the pdf and eps files?

 

Regards,

Mike

 

Likes

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
Community Beginner ,
May 27, 2022 May 27, 2022

Copy link to clipboard

Copied

Hi @mikeb41294032 

 

I should expand by saying that the file that needs to be exported to pdf and eps contains multiple pages that would each need a separate file upon export. They also need all text outlined prior to exported to high quality print PDF. The file is the result of a data merge for printing business cards. Hopefully that answers your question.

 

Thank you,

Kellie

Likes

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
Advocate ,
May 27, 2022 May 27, 2022

Copy link to clipboard

Copied

Hi @kellie.rock29,

 

That helps regarding the pdf export preset but what about the eps settings (what are you selecting) and what would be the name of the individual files?

when you export eps files there are a lot of options to consider...

 

Screen Shot 2022-05-27 at 1.22.42 PM.pngScreen Shot 2022-05-27 at 1.22.55 PM.png

Regards,

Mike

Likes

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
Community Beginner ,
May 27, 2022 May 27, 2022

Copy link to clipboard

Copied

Hi @mikeb41294032 

 

Yes sorry. For the eps it would be all of the default selections you have here, except for the transparency flattener which would need to be high resolution. Ideally the names of the files would be pulled from the designated last name in the data merge, but I'm not sure if that's possible.

 

Thanks again,

Kellie

Likes

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
Advocate ,
May 27, 2022 May 27, 2022

Copy link to clipboard

Copied

Hi @kellie.rock29,

 

Give this a try...

1. Start off by creating a Paragraph style named "PDF_name"

2. Create a text box in the slug area with a portion of the box within the page bounds and assign the Paragraph style "PDF_name"

3. Assign the field from the data source for the pdf naming to that text box

4. Create and save the Merged document, run the script to export the pdfs


The below script will export the eps and pdfs named by the contents of the text box useing the Paragraph style named "PDF_name from each page.

 

 

 

doc = app.documents[0];
var fileName = doc.name.replace(/.indd$/i, "");
var PDF_Folder = Folder(doc.filePath + '/PDF');
var EPS_Folder = Folder(doc.filePath + '/EPS');
var export_preset = app.pdfExportPresets.item("[High Quality Print]");

if (!PDF_Folder.exists) {
    PDF_Folder.create(); 
}
 
if (!EPS_Folder.exists) {
    EPS_Folder.create(); 
}

    for(var p = 0; p < app.documents[0].pages.length; p++) {  
        var frames = app.documents[0].pages[p].textFrames;
        var myPageName = app.documents[0].pages[p].name;  
        var pdf_name = null;  
          
    for(var i = 0; i < frames.length; i++) { 
      try {if(frames[i].paragraphs[0].appliedParagraphStyle.name == 'pdf_name') {  
        pdf_name = frames[i].paragraphs[0].contents;  
         break;  
        }
        }catch (e){
     }  
  }

   if (pdf_name == null) { 
    alert ('Error!\nThe Paragraph Style "PDF_name" is not applied to one or more of the pages or is Labeled Incorrectly.');
    exit();
    }
      
  if(pdf_name != null) {  

// eps export preferences
app.epsExportPreferences.pageRange = String(myPageName);

app.epsExportPreferences.epsColor = EPSColorSpace.CMYK;

app.epsExportPreferences.dataFormat = DataFormat.ASCII;

app.epsExportPreferences.postscriptLevel = PostScriptLevels.LEVEL_2;

app.epsExportPreferences.preview = PreviewTypes.TIFF_PREVIEW;

app.epsExportPreferences.fontEmbedding = FontEmbedding.SUBSET;

app.epsExportPreferences.bleedTop = 0;

app.epsExportPreferences.bleedBottom = 0;

app.epsExportPreferences.bleedInside = 0;

app.epsExportPreferences.bleedOutside = 0;

app.epsExportPreferences.appliedFlattenerPreset = "[High Resolution]";


var myPageItems = app.documents[0].pages[p].allPageItems, textFrame; 
while(textFrame = myPageItems.pop()) {
 if(!(textFrame instanceof TextFrame)) continue; 
  try{var outlineList = textFrame.createOutlines(true);
  }catch(e){} 
 }

doc.exportFile(ExportFormat.EPS_TYPE,File(EPS_Folder + "/" + pdf_name + ".eps"),false);

app.pdfExportPreferences.pageRange = app.documents[0].pages[p].name; 
doc.exportFile(ExportFormat.PDF_TYPE, File(PDF_Folder + '/' + pdf_name + ".pdf"), false, export_preset);
  }
}
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
doc.revert();
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL;

alert("Done exporting files!")

 

 

 

 

Regards,

Mike

 

Likes

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
Adobe Community Professional ,
May 27, 2022 May 27, 2022

Copy link to clipboard

Copied

I would go that way:

 

  1. Export as PDF. Never make outlines in InDesign.
  2. In Acrobat Pro > Tools > Print Production > Preflight > … You find a setting to outline text. That is the only correct way to do it.
  3. In Acrobat you can save as EPS.

 

But for the future I would try to find a better printer who does not require odd workflows from the past millenium neither is outlining text nor is using EPS an appropriate method to work with InDesign.

Likes

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
Adobe Community Professional ,
May 27, 2022 May 27, 2022

Copy link to clipboard

Copied

LATEST

All steps in Acrobat Pro can be batched automatically.

Likes

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