Skip to main content
duyv50210174
Participant
December 17, 2021
Answered

Batch export AI file into PDFs with adobe PDF presets and adding suffix

  • December 17, 2021
  • 5 replies
  • 4899 views

Hi all,

I was wondering if someone could please help me and see if this is possible.  I have limited knowledge of scripts and need some help.  I have to export several Ai files to pdf daily at my work, and save as a "LowRes" Adobe PDF preset, and add "_LowRes" to the pdf name. Then export again with "HiRes" Adobe PDF preset (mostly adding trim marks/bleed), and add "_HiRes" to the pdf name. Right now, its all manual work to do that for each AI files.

 

Is it possible with a script to do this: 

1. Select a folder/ grab XX of these AI files. 
2. Export 2 versions of each file 
  • A. With “XX” PDF preset settings and add “_LowRes” to file name
  • B. With “XX” PDF preset settings and add “_HiRes” to file name 

 

Any help would be greatly appreciated, Thanks in advance!
Correct answer femkeblanco

I don't have "LowRes" and "HiRes" PDF presets, so I've used "High Quality Print" and "Smallest File Size". 

 

var files = File.openDialog("Select files", "*.ai", true);
for (var i = 0; i < files.length; i++) {
    app.open(files[i]);
    var file1 = new File(String(files[i].fullName).slice(0, -3) + "_HiRes.pdf");
    var file2 = new File(String(files[i].fullName).slice(0, -3) + "_LowRes.pdf");
    var PDF1 = new PDFSaveOptions();
    var PDF2 = new PDFSaveOptions();
    PDF1.pDFPreset = "[High Quality Print]";
    PDF2.pDFPreset = "[Smallest File Size]";
    app.activeDocument.saveAs(file1, PDF1);
    app.activeDocument.saveAs(file2, PDF2);
    app.activeDocument.close();
}

5 replies

Participant
March 7, 2025

Hi everyone,

 

I work a lot with Adobe Illustrator myself and created a handy script that lets you easily batch-convert AI files into PDFs, including customizable PDF presets (web, print-quality, etc.).

 

You can download the script directly for free here (no login required):

👉 https://zeilenhoehe.de/ai-to-pdf-batch-converter-adobe-illustrator-script/

 

If you’d like, you can also voluntarily sign up for updates, additional Illustrator tips, and more free tools.

 

I’d be happy about your feedback and hope this makes your workflow easier!

Nicky G.
Known Participant
March 28, 2023

Nice script. It works. Both PDF saving and Outline conversion. I would just like to ask for clarifications:

1. How can I make the files save or the file into a new *.ai file? instead of PDFs.

2. How can I convert the texts to outlines if the font (embedded in the PDF is not present in my OS?) It currently opens the file for me, changing the font and converting it to curves.
Would it be possible to convert this to the embedded PDF level?

3. If the text in the original file inadvertently contains overset text (symbol [+] on text block), is it possible to insert an ALLERT before converting to outlines?


Basically I'm looking for a way to open *.pdf files by converting the paths (taking advantage of the font embedded in the pdf).
How many of you have experienced the situation that they send you a pdf, a logo and you don't have the font?
There is a solution with Acrobat that converts everything into vectors but it is a very cumbersome solution.

Disposition_Dev
Legend
March 28, 2023

1. change the extension in the output file name to ".ai" instead of ".pdf" and remove the PDFSaveOptions

2. loop all the textFrames and outline them with textFrame.createOutline();

3. yes, you could send an alert. you could also use the script to shrink the text until it is no longer overset, then createOutline()

Nicky G.
Known Participant
March 28, 2023

So I attach the script done so far.

a) Opens me *.ai,pdf files etc., Saves me in different formats (ai, pdf)
b) If the font is installed in the OS the script works 100%.
c) When and what doesn't work: If the font is not present in the system, or if the text block is not fully open [+] .
d) How could convert to curves be done before Illustrator opens the document and then locates the missing fonts?

Workaround: AFFINITY DESIGNER! They thought to put a nice (beautiful) check before opening the pdf. Do you want to convert the texts to curves before I import the pdf into the file?? YES!!!!
the ADOBE? He is sleeping!



var files = File.openDialog("Select files", "*.ai, *.pdf", true);

for (var i = 0; i < files.length; i++) {
app.open(files[i]);

var frames = app.activeDocument.textFrames;
for(var f=0; f<frames.length;f++) {
frames[f].createOutline();
}

}


for (var i = 0; i < files.length; i++) {
app.open(files[i]);

var file0 = new File(String(files[i].fullName).slice(0, -3) + "_HiRes.ai");
var file1 = new File(String(files[i].fullName).slice(0, -3) + "_HiRes.pdf");
var file2 = new File(String(files[i].fullName).slice(0, -3) + "_LowRes.pdf");

var PDF1 = new PDFSaveOptions();
var PDF2 = new PDFSaveOptions();
PDF1.pDFPreset = "[Qualità tipografica]";
PDF2.pDFPreset = "[Dimensione file minima]";

app.activeDocument.saveAs(file0);
app.activeDocument.saveAs(file1, PDF1);
app.activeDocument.saveAs(file2, PDF2);

app.activeDocument.close();

}

Participant
August 15, 2022

Dear all, thank you for this script.
Can someone explain to me how I can add the action "select all > change to lettercontour"?

Thank you! Linda

Disposition_Dev
Legend
August 15, 2022

var frames = app.activeDocument.textFrames;

for(var f=0;f<frames.length;f++)

{

    frames[f].createOutline();

}

femkeblanco
femkeblancoCorrect answer
Legend
December 17, 2021

I don't have "LowRes" and "HiRes" PDF presets, so I've used "High Quality Print" and "Smallest File Size". 

 

var files = File.openDialog("Select files", "*.ai", true);
for (var i = 0; i < files.length; i++) {
    app.open(files[i]);
    var file1 = new File(String(files[i].fullName).slice(0, -3) + "_HiRes.pdf");
    var file2 = new File(String(files[i].fullName).slice(0, -3) + "_LowRes.pdf");
    var PDF1 = new PDFSaveOptions();
    var PDF2 = new PDFSaveOptions();
    PDF1.pDFPreset = "[High Quality Print]";
    PDF2.pDFPreset = "[Smallest File Size]";
    app.activeDocument.saveAs(file1, PDF1);
    app.activeDocument.saveAs(file2, PDF2);
    app.activeDocument.close();
}
duyv50210174
Participant
December 17, 2021

Thank you so much!! This worked like a charm:) I was able to swap out the naming of the presets. You made my day! 

 

Kurt Gold
Community Expert
Community Expert
December 17, 2021

Which version of Illustrator are you using?

 

duyv50210174
Participant
December 17, 2021

Hi Kurt, 

 

I'm using Illustrator 2022 CC.