Copy link to clipboard
Copied
I want to change a few PDF export settings and then export a PDF of the active document. I didn't win with using the script to change the settings, so instead, I made a PDF export preset (.joboptions file).
How do I select that preset when I export using the script?
app.activeDocument.exportFile(ExportFormat.pdfType, File("testDocument.pdf"), true, PDFExportPreset.MyPDFPreset);
Copy link to clipboard
Copied
app.pdfExportPresets.item ('[Smallest File Size]')
P.
Copy link to clipboard
Copied
sorry I'm confused, that still isn't working for me?
Copy link to clipboard
Copied
Try this, where you named the preset you created 'My own preset':
myPreset = app.pdfExportPresets.item ('My own preset');
app.activeDocument.exportFile(ExportFormat.pdfType, File("testDocument.pdf"), true, myPreset);
Copy link to clipboard
Copied
Ah perfect!
Copy link to clipboard
Copied
it runs with no errors, but it's still defaulting to [High Quality Print].
Copy link to clipboard
Copied
it must be something wrong with my syntax because if I try to select [Press Quality], this way, it still defaults to [High Quality Print]
Copy link to clipboard
Copied
If it were a syntax error, InDesign would have thrown an error. Do you have any spaces or or other funny characters in the name of your preset? (I can't believe I put spaces in me example!) Use only unaccented letters and digits in the preset name. No spaces. You can use underscore characters for spaces if you want.
Copy link to clipboard
Copied
none, I thought the same thing, so I changed the name to just a word "jetline"
Copy link to clipboard
Copied
I put in an alert to show me what is actually being referenced and it looks like its getting
[object PDFExportPreset] which I'm guessing is where the issue is?
var myPreset = app.pdfExportPresets.item ("jetline");
alert("This will pre-apply the export preset: "+myPreset);
app.activeDocument.exportFile(ExportFormat.pdfType, File("exported_from_IDT"+cleanFileName+".pdf"), false, myPreset);
Copy link to clipboard
Copied
You still don't check whether the preset exists. Do this:
alert (app.pdfExportPresets.item ("jetline").isValid);
which shows an alert saying 'true' or 'false'.
(I've never seen the behaviour you describe.)
Copy link to clipboard
Copied
it's coming back true, but still doesn't select it.
Copy link to clipboard
Copied
Hi nough7_za,
Try below code:
var selectedPdfPreset = '[Press Quality]';
var name = "C:\\Users\\karthiks\\Desktop\\Demo\\karthik.pdf"
app.activeDocument.exportFile(ExportFormat.pdfType, name, false, selectedPdfPreset);
Thanks,
Karthik S
Copy link to clipboard
Copied
Karthik -- The preset should be an object, not a string.