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

saveAs() method doesn't work for PDF file

New Here ,
Nov 29, 2008 Nov 29, 2008
I used the script below to generate a PDF file. When I ran it, no error occurred but no PDF was generated either

var pdf = new File("E:\\STWWEB1\\CDLG_ILL\\temp\\jpeg\\640\\1.pdf");

docRef.saveAs(pdf);

Does anybody know what's wrong?
TOPICS
Scripting
908
Translate
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 ,
Nov 30, 2008 Nov 30, 2008
Yes, your file path. It needs to be something like this:
"/E/STWWEB1/CDLG_ILL/temp/jpeg/640/1.pdf"
Translate
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
New Here ,
Nov 30, 2008 Nov 30, 2008
I used the same kind of path to saveAs() AI and it worked though i.e.

var ai = new File("E:\\STWWEB1\\CDLG_ILL\\temp\\jpeg\\640\\1.ai");
docRef.saveAs(ai)

Anyway, I would still try what you suggested. Thanks.
Translate
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
New Here ,
Nov 30, 2008 Nov 30, 2008
I used the same kind of path to saveAs() AI and it worked though i.e.

var pdf = new File("E:\\STWWEB1\\CDLG_ILL\\temp\\jpeg\\640\\1.ai");
docRef.saveAs(ai)

Anyway, I would still try what you suggested. Thanks.
Translate
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
New Here ,
Dec 05, 2008 Dec 05, 2008
Hi try67,

I tried what you suggested and it still didn't save the file as PDF. Do you know why?
Translate
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 ,
Dec 05, 2008 Dec 05, 2008
LATEST
PDF needs to have a new instance of the PDFSaveOptions created. Look at the JS Reference

PDFSaveOptions

Options for saving a document as an Adobe PDF file, used with the saveAs method. All properties are optional.

Saving to PDF format
// Saves the current document as PDF to dest with specified options
// dest contains the full path and file name to save to
function saveFileToPDF (dest) {
var doc = app.activeDocument;
if ( app.documents.length > 0 ) {
var saveName = new File ( dest );
saveOpts = new PDFSaveOptions();
saveOpts.compatibility = PDFCompatibility.ACROBAT5;
saveOpts.generateThumbnails = true;
saveOpts.preserveEditability = true;
doc.saveAs( saveName, saveOpts );
}
}
Translate
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