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

Batch Convert EPS to PDF

Explorer ,
Mar 21, 2022 Mar 21, 2022

Copy link to clipboard

Copied

Would like a script that can batch convert multiple eps files into pdf files "without opening them" and retain any live text or placed images. I use to use Acrobat Distiller but it is no longer working. I have an action that can convert eps files to pdfs but takes a long time since each file needs to be opened. Currently on Illustrator 24.3. 

 

Thanks!

TOPICS
Scripting

Views

468

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

correct answers 1 Correct answer

Participant , Mar 21, 2022 Mar 21, 2022

hey @WA_ART   this code was taken from Examples scripts provided by Adobe

check out maybe can help you

 

var selectFile = File.openDialog("select your files", (Multiselect = true));
for (var i = 0; i < selectFile.length; i++) {
  var openFiles = app.open(File(selectFile[i]));
}
var cntDocs = app.documents.length;
for (i = 0; i <= cntDocs - 1; i++) {
  app.executeMenuCommand("fitin");
  
  try {
    // uncomment to suppress Illustrator warning dialogs
    // app.userInteractionLevel = UserInteractio
...

Likes

Translate

Translate
Advisor ,
Mar 21, 2022 Mar 21, 2022

Copy link to clipboard

Copied

For a script to manipulate document files, it has to open them. 

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
Explorer ,
Mar 21, 2022 Mar 21, 2022

Copy link to clipboard

Copied

Is it possible to open but skip font requests and/or similar prompts?

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 Expert ,
Mar 22, 2022 Mar 22, 2022

Copy link to clipboard

Copied

not if you want the proper fonts to exist in the document. those prompts are illustrator telling you "there's a gap in the information for this file, so i don't know what to put here." if you don't put anything into that dialog, it can't properly render a PDF. It's like hiring a pizza delivery driver, handing them a stack of pizzas and saying "go deliver these." and when they ask for addresses for where they should be delivered, you close the door and walk away. the dialog is that request for addresses. 

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
Explorer ,
Mar 22, 2022 Mar 22, 2022

Copy link to clipboard

Copied

I  prefer to have the live font but not have the font prompt halt the conversion. I tried the script GerssonDelgado provided below and that seems to do exactly what I need but was hoping there was a way to basically run in the background without having to fully load each file. Appreciate the help!

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
Participant ,
Mar 21, 2022 Mar 21, 2022

Copy link to clipboard

Copied

hey @WA_ART   this code was taken from Examples scripts provided by Adobe

check out maybe can help you

 

var selectFile = File.openDialog("select your files", (Multiselect = true));
for (var i = 0; i < selectFile.length; i++) {
  var openFiles = app.open(File(selectFile[i]));
}
var cntDocs = app.documents.length;
for (i = 0; i <= cntDocs - 1; i++) {
  app.executeMenuCommand("fitin");
  
  try {
    // uncomment to suppress Illustrator warning dialogs
    // app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;

    if (app.documents.length > 0) {
      var doc = app.activeDocument;
      // Get the folder to save the files into
      var destFolder = null;
      destFolder = doc.path.fsName;

      if (destFolder != null) {
        var options, i, sourceDoc, targetFile;

        // Get the PDF options to be used
        options = this.getOptions();
        // You can tune these by changing the code in the getOptions() function.

        for (i = 0; i < app.documents.length; i++) {
          sourceDoc = app.documents[i]; // returns the document object

          // Get the file to save the document as pdf into
          targetFile = this.getTargetFile(sourceDoc.name, ".pdf", destFolder);

          // Save as pdf
          sourceDoc.saveAs(targetFile, options);
        }
        //alert( 'Documents saved as PDF' );
      }
    } else {
      throw new Error("There are no document open!");
    }
  } catch (e) {
    alert(e.message, "Script Alert", true);
  }

  /** Returns the options to be used for the generated files.
	@return PDFSaveOptions object
*/
  function getOptions() {
    // Create the required options object
    var options = new PDFSaveOptions();
    // See PDFSaveOptions in the JavaScript Reference for available options

    // Set the options you want below:

    // For example, uncomment to set the compatibility of the generated pdf to Acrobat 7 (PDF 1.6)
    // options.compatibility = PDFCompatibility.ACROBAT7;

    // For example, uncomment to view the pdfs in Acrobat after conversion
    // options.viewAfterSaving = true;

    return options;
  }

  /** Returns the file to save or export the document into.
	@param docName the name of the document
	@param ext the extension the file extension to be applied
	@param destFolder the output folder
	@return File object
*/
  function getTargetFile(docName, ext, destFolder) {
    var newName = "";

    // if name has no dot (and hence no extension),
    // just append the extension
    if (docName.indexOf(".") < 0) {
      newName = docName + ext;
    } else {
      var dot = docName.lastIndexOf(".");
      newName += docName.substring(0, dot);
      newName += ext;
    }

    // Create the file object to save to
    var myFile = new File(destFolder + "/" + newName);

    // Preflight access rights
    if (myFile.open("w")) {
      myFile.close();
    } else {
      throw new Error("Access is denied");
    }
    return myFile;
  }
}

app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
for (ii = 0; ii <= cntDocs - 1; ii++) {
  app.executeMenuCommand("close");
  doc = null;
}

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
Explorer ,
Mar 22, 2022 Mar 22, 2022

Copy link to clipboard

Copied

Thanks! This seemed to work well. Do you know of a script that will do exactly this but without opening each file?

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
Participant ,
Mar 22, 2022 Mar 22, 2022

Copy link to clipboard

Copied

as @femkeblanco  mentioned in the first comment "For a script to manipulate document files, it has to open them."

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
Explorer ,
Mar 22, 2022 Mar 22, 2022

Copy link to clipboard

Copied

Okay thanks that is what I thought based on femkeblanco's post! Is there anything outside of Illustrator that would do this? I used to be able to use Acrobat Distiller to batch convert multiple eps files but can no longer use Distiller. I cannot remember if Distiller would keep fonts live or convert to outlines though.

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
Explorer ,
Nov 03, 2022 Nov 03, 2022

Copy link to clipboard

Copied

LATEST

Was possible that script close files in illustrator and not to open result pdf in acrobat? simply to work file by file? all this use resources cpu and memory.

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 Expert ,
Mar 22, 2022 Mar 22, 2022

Copy link to clipboard

Copied

"eps files but can no longer use Distiller"

Why not? What error is it throwing?

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
Explorer ,
Mar 22, 2022 Mar 22, 2022

Copy link to clipboard

Copied

I keep getting "Distiller quit unexpectedly." I would try to reinstall but not finding in CC to do that. Looks like it has been discontinued.

 

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