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

Scripting – Remember PDF export preferences and save them as a new preset

Community Beginner ,
Jul 01, 2021 Jul 01, 2021

Copy link to clipboard

Copied

Hi all!

 

I've been trying my best to figure this one out but so far no success. I'm working on a script where the user can export a PDF from an open InDesign file and then the remaining openend InDesign files get exported with the same preferences. Is there a way to "remember" all the preferences of the export and the save them as a preset? I currently don't see a way around having to save attribute separately, which frankly sounds dreadful. Any ideas are much appreciated!

TOPICS
Scripting

Views

421

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 , Jul 01, 2021 Jul 01, 2021

What's your current code? All export properties are available as app.PDFExportPreferences.properties

 

You can add Export presets on the fly with app.PDFExportPresets.add({your property pairs})

 

You can map export properties to preset properties. Pseudocode is: 

for prop in exportPref properties, if preset has own property that matches, try/catch to add the value

 

Realistically, the export preferences should not change if set during the first export. Just don't use a preset for subsequent expo

...

Votes

Translate

Translate
Community Expert ,
Jul 01, 2021 Jul 01, 2021

Copy link to clipboard

Copied

What's your current code? All export properties are available as app.PDFExportPreferences.properties

 

You can add Export presets on the fly with app.PDFExportPresets.add({your property pairs})

 

You can map export properties to preset properties. Pseudocode is: 

for prop in exportPref properties, if preset has own property that matches, try/catch to add the value

 

Realistically, the export preferences should not change if set during the first export. Just don't use a preset for subsequent exports in your exportFile call. 

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 Beginner ,
Jul 02, 2021 Jul 02, 2021

Copy link to clipboard

Copied

LATEST

Damn, the very last sentence never even crossed my mind but now seems so obvious! My script had a window pop up where the user could choose the most important preferences (preset, bleed, page range etc.) and the script would duplicate the selected preset, apply the selected preferences, export the PDFs and then remove the newly created preset. This worked fine but I was curious if this was possible with just the regular export dialog. I guess this was a good exercise in creating a dialog window ;-). Thank you!

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 ,
Jul 01, 2021 Jul 01, 2021

Copy link to clipboard

Copied

And: You could store the object {your property pairs} with all the property/value pairs as string with a label. For that see into methods insertLabel("keyString","valueString") and extractLabel("keyString") with the document object or even the application object; or you write them to a text file followed by method doScript() to execute a string as script out of the extracted label or the file you saved.

 

Regards,
Uwe Laubender

( ACP )

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