Script to save the .ai file to .pdf file in the default path, where it is located

Explorer ,
Jan 22, 2022 Jan 22, 2022

Copy link to clipboard

Copied

Hi all,

 

I am struggling to write a script to save the ".ai file" to ".pdf file" in the default path, where it is located  like(C drive or D drive ). Kindly help in this concern.

TOPICS
Scripting

Views

87

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

Adobe Community Professional , Jan 22, 2022 Jan 22, 2022
Hi, Try following snippet. This will save the pdf at the same path where your ai file exists and with the same name as as your ai file. var _doc = app.activeDocument; var _name = _doc.name.replace('.ai', ''); var _path = _doc.path; var _pdfFile = File(_path + '/' + _name + '.pdf'); var saveOpts = new PDFSaveOptions(); saveOpts.preserveEditability = true; PDFSaveOptions.viewAfterSaving = false; _doc.saveAs(_pdfFile, saveOpts);

Likes

Translate

Translate
Adobe Community Professional ,
Jan 22, 2022 Jan 22, 2022

Copy link to clipboard

Copied

Hi,

Try following snippet. This will save the pdf at the same path where your ai file exists and with the same name as as your ai file.

 

var _doc = app.activeDocument;
var _name = _doc.name.replace('.ai', '');
var _path = _doc.path;
var _pdfFile = File(_path + '/' + _name + '.pdf');
var saveOpts = new PDFSaveOptions();
saveOpts.preserveEditability = true;
PDFSaveOptions.viewAfterSaving = false;
_doc.saveAs(_pdfFile, saveOpts);

 

Best regards

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 ,
Jan 22, 2022 Jan 22, 2022

Copy link to clipboard

Copied

LATEST

Thank you so much

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