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

What am I doing wrong? (PDF Export via script from InDesign)

Explorer ,
Jan 28, 2020 Jan 28, 2020

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);

 

 pdf_export_problem.PNG

TOPICS
Scripting

Views

1.2K

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 ,
Jan 28, 2020 Jan 28, 2020

Copy link to clipboard

Copied

app.pdfExportPresets.item ('[Smallest File Size]')

 

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 ,
Jan 28, 2020 Jan 28, 2020

Copy link to clipboard

Copied

sorry I'm confused, that still isn't working for me?

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 ,
Jan 28, 2020 Jan 28, 2020

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);

 

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 ,
Jan 28, 2020 Jan 28, 2020

Copy link to clipboard

Copied

Ah perfect!

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 ,
Jan 28, 2020 Jan 28, 2020

Copy link to clipboard

Copied

it runs with no errors, but it's still defaulting to [High Quality Print].

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 ,
Jan 28, 2020 Jan 28, 2020

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]

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 ,
Jan 28, 2020 Jan 28, 2020

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.

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 ,
Jan 28, 2020 Jan 28, 2020

Copy link to clipboard

Copied

none, I thought the same thing, so I changed the name to just a word "jetline"

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 ,
Jan 28, 2020 Jan 28, 2020

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?

 

object.PNG

 

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);

 

 

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 ,
Jan 29, 2020 Jan 29, 2020

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.)

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 ,
Jan 30, 2020 Jan 30, 2020

Copy link to clipboard

Copied

LATEST

it's coming back true, but still doesn't select it.

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
Contributor ,
Jan 28, 2020 Jan 28, 2020

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

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 ,
Jan 29, 2020 Jan 29, 2020

Copy link to clipboard

Copied

Karthik -- The preset should be an object, not a string.

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