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

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

261

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

Community Expert , 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);

 

Votes

Translate

Translate
Adobe
Community Expert ,
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

Votes

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

Votes

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