Skip to main content
Bria5EB3
Known Participant
January 31, 2023
Answered

Export ai and PDF with setttings at the same time

  • January 31, 2023
  • 3 replies
  • 1790 views

Hello. I recall seeing something like this a while ago but can't remember how it was implemented. What I'm trying to achieve is saving a document as an .ai file and a PDF file at the same time in 2 different locations. They would both share the same filename. For example the .ai file would save on the desktop and the PDF file would save in another folder with other PDFs. I would also need the PDF to save as "Smallest File Size" option.

 

Is there a feature, script or option that can accomplish this?

 

Thank you.

This topic has been closed for replies.
Correct answer femkeblanco
var name1 = prompt("Enter file name:", "");
var file1 = new File("~/Desktop/" + name1); 
var file2 = new File("~/Desktop/" + name1);
var PDF = new PDFSaveOptions;
PDF.pDFPreset = "[Smallest File Size]";
app.activeDocument.saveAs(file1);
app.activeDocument.saveAs(file2, PDF);

3 replies

femkeblanco
Legend
February 1, 2023

This is a bare minimum script.  The first line contains the AI path, the second line the PDF path, the target for both being set to desktop.  You can change the path using the following syntax (for Windows):  "/C/Users/femkeblanco/Desktop/"

var file1 = new File("~/Desktop/"); 
var file2 = new File("~/Desktop/");
var PDF = new PDFSaveOptions;
PDF.pDFPreset = "[Smallest File Size]";
app.activeDocument.saveAs(file1);
app.activeDocument.saveAs(file2, PDF);
Bria5EB3
Bria5EB3Author
Known Participant
February 3, 2023

Thank you, this is what we were looking for. Thank you so much!

As an alternative - is there a line of code or so that could be added to this that could let you choose a filename when saving.? Same file name for both ai and PDF.

femkeblanco
femkeblancoCorrect answer
Legend
February 3, 2023
var name1 = prompt("Enter file name:", "");
var file1 = new File("~/Desktop/" + name1); 
var file2 = new File("~/Desktop/" + name1);
var PDF = new PDFSaveOptions;
PDF.pDFPreset = "[Smallest File Size]";
app.activeDocument.saveAs(file1);
app.activeDocument.saveAs(file2, PDF);
Community Manager
January 31, 2023

Hello @Bria5EB3,

 

Thanks for reaching out. I hope the suggestions shared by Kurt helped answer your queries. You may also want to try the suggestions shared in this community post (https://community.adobe.com/t5/illustrator-discussions/script-to-save-different-file-formats/td-p/9031798) and check if it helps.

 

Looking forward to your response.

 

Thanks,

Anubhav

Kurt Gold
Community Expert
Community Expert
January 31, 2023

That may have been an action, possibly run as a Batch process.

 

Bria5EB3
Bria5EB3Author
Known Participant
January 31, 2023

Interesting. Do you know where I might find something like that?

Kurt Gold
Community Expert
Community Expert
January 31, 2023

You may create your own action. It's pretty easy to record it in the Actions palette.