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

pdf export with jsx script

Explorer ,
Apr 12, 2023 Apr 12, 2023

Copy link to clipboard

Copied

hi all

I want to create to pdf of my indd doc using job options preset.

One pdf is hires and the other low res.

this is my MAC OS script:

var doc = app.activeDocument;
var filePath = doc.filePath;

// Impostazioni job options
var pressQualityJobOptions = File("/Library/Application Support/Adobe/Adobe PDF/Settings/Press Quality.joboptions");

var lightJobOptions = File("/Library/Application Support/Adobe/Adobe PDF/Settings/versione light.joboptions");

// Esporta il PDF con le impostazioni "Press Quality"
var pdfPressQuality = app.pdfExportPresets.itemByName("Press Quality");
doc.exportFile(ExportFormat.pdfType, File(filePath + "/" + doc.name.replace(/\.[^\.]+$/, '') + ".pdf"), false, pdfPressQuality, pressQualityJobOptions);

// Esporta il PDF con le impostazioni "versione light"
var pdfLight = app.pdfExportPresets.itemByName("versione light");
doc.exportFile(ExportFormat.pdfType, File(filePath + "/" + doc.name.replace(/\.[^\.]+$/, '') + " light.pdf"), false, pdfLight, lightJobOptions);

 

when I run the script I receive this msg:

JavaScript Error!
Codice errore: 30477
Stringa errore: Valore non valido per il parametro "using" del metodo
"exportFile". Era previsto PDFExportPreset, ma è stato ricevuto nothing.
Motore: main
File: /Users/macstudio01/Library/Preferences/Adobe InDesign/
Version 18.0/it IT/Scripts/Scripts Panel / mio script PDF.is>
Riga: 11
Sorgente: doc.exportFile(ExportFormat.pdfType, File(filePath + "/" +
doc.name.replace(/\.[^\.]+ $/, ") + "pdf"), false, pdfPressQuality,
pressQualityJobOptions);

it seems script cant locate the job options

could you help me please?
thx

TOPICS
How to , Scripting

Views

387

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 , Apr 13, 2023 Apr 13, 2023

The predefined job options are in brackets, you should include them:

var pdfPressQuality = app.pdfExportPresets.itemByName("[Press Quality]");

You should check whether the job option exists:

if (!app.pdfExportPresets.itemByName("[Press Quality]").isValid) {
  alert (". . .");
  exit();
}

Also, the fifth parameter in your two export instances is for version comments, not another job option.

 

P.

Votes

Translate

Translate
Community Expert ,
Apr 13, 2023 Apr 13, 2023

Copy link to clipboard

Copied

The predefined job options are in brackets, you should include them:

var pdfPressQuality = app.pdfExportPresets.itemByName("[Press Quality]");

You should check whether the job option exists:

if (!app.pdfExportPresets.itemByName("[Press Quality]").isValid) {
  alert (". . .");
  exit();
}

Also, the fifth parameter in your two export instances is for version comments, not another job option.

 

P.

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 ,
Apr 13, 2023 Apr 13, 2023

Copy link to clipboard

Copied

thank you Peter for reply.

I've added the check for job options and the script tell me there is no job option [alert (". . .")]

After debugging the filename, the script WORKS!

 

Grazie, ti devo una birra
🙂

 

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
Community Expert ,
Apr 13, 2023 Apr 13, 2023

Copy link to clipboard

Copied

Hi @milko259349307s4y ,

also note that the name of the PDF export preset is localized.

So Peter's sample code would return an alert when run on my German InDesign.

Its name in my German version is "[Druckausgabequalität]" for "[Press Quality]".

 

Regards,
Uwe Laubender
( Adobe Community Expert )

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 ,
Apr 13, 2023 Apr 13, 2023

Copy link to clipboard

Copied

yes, I understood it,

thankyou Laubender

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
Community Expert ,
Apr 13, 2023 Apr 13, 2023

Copy link to clipboard

Copied

LATEST

You can show the presets via File > Adobe PDF Presets, see the screenshot. You should use preset names exactly as you see them there (apart from the three dots).

 

PeterKahrel_0-1681388744445.png

 

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