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

InDesign Server: Error: Failed to Export the PDF file.

New Here ,
Mar 06, 2020 Mar 06, 2020

I wrote a script to export a PDF file, which works perfectly in InDesign but fails in InDesign Server with just "Error: Failed to Export the PDF file."

I've tried searching for other reports of this problem but haven't found anything that helps so far.
Am I doing something wrong?

var isServer = app.name === "Adobe InDesign Server";
var inddFile = File(inddFileFullPath);
var pdfFile = File(inddFile.fullName.replace(".indd", ".pdf"));

if (isServer) {
    var pdfExportPreset = app.pdfExportPresets.itemByName("[Smallest File Size]");
    app.open(tempFile, OpenOptions.openOriginal);
    app.documents[0].exportFile(ExportFormat.PDF_TYPE, pdfFile);
}
else {
    app.open(inddFile, false, OpenOptions.openOriginal);
    app.documents[0].exportFile(ExportFormat.pdfType, pdfFile, false);
}

app.documents[0].close(SaveOptions.NO);

 

TOPICS
Import and export , Scripting
1.3K
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
Enthusiast ,
Mar 07, 2020 Mar 07, 2020

Hi,

Try this ...

var isServer = app.name === "Adobe InDesign Server";
var inddFile = File(inddFileFullPath);
var pdfFile = File(inddFile.fullName.replace(".indd", ".pdf"));

if (isServer) {
    var pdfExportPreset = app.pdfExportPresets.itemByName("[Smallest File Size]");
    //app.open(tempFile, OpenOptions.openOriginal);
    app.open(inddFile);
    app.documents[0].exportFile(ExportFormat.PDF_TYPE, pdfFile);
}
else {
    app.open(inddFile, false, OpenOptions.openOriginal);
    app.documents[0].exportFile(ExportFormat.pdfType, pdfFile, false);
}

app.documents[0].close(SaveOptions.NO);

 You don't use pdfExportPreset, it's normal ?

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 ,
Mar 09, 2020 Mar 09, 2020

Thanks.  This doesn't work for me either.  It still throws the "Failed to Export the PDF file" error.

 

So far it hasn't seemed to matter whether I use pdfExportPreset or not.  I posted this question partly to find out what's normal, in case I'm doing something wrong.

 

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
Guest
Mar 10, 2020 Mar 10, 2020

 

the three parameters Are

1.ExportFormat.PDF_TYPE

2.FILE

3.PRESET Name

try this,

 

var myDoc=app.documents[0]

var docPath=myDoc.filePath

var printOption="yourPresetName"

var docName=myDoc.name

myDoc.exportFile(ExportFormat.PDF_TYPE, File(docPath.parent + "/" + "PDF/" + docName.split(".")[0] + "_PrintPDF.pdf"), printOption.toString()); // For Server

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 ,
Mar 10, 2020 Mar 10, 2020

Don'tknow enough about indeign server but why is the indesign exporting to:

ExportFormat.pdfType

and the server:

ExportFormat.PDF_TYPE

 

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 ,
Mar 11, 2020 Mar 11, 2020
LATEST

The InDesign API documentation lists the enum as ExportFormat.PDF_TYPE, but in JavaScript/ExtendScript it doesn't seem to matter if I use that or ExportFormat.pdfType.  I probably should have standardized them before posting this.

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