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
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.
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.
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
š
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 )
Copy link to clipboard
Copied
yes, I understood it,
thankyou Laubender
Copy link to clipboard
Copied
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).