Skip to main content
Participant
February 14, 2011
Question

Update PDF Export Preset list when updated outside of InDesign

  • February 14, 2011
  • 2 replies
  • 682 views

Hello,

For our application we would like to be able to update the list of PDF Export Presets by adding .joboptions files on the filesystem. We need to be able to select such a previously added joboptions file when executing our script that exports a PDF File. The problem is, however that changes to the .joboptions directory in disk are not recognized by InDesign immediately. Navigating to the File > Adobe PDF Presets menu item will update the list right away, but we found no way to update the internal list of PDF Export Presets programatically. Is there a way to update the list programatically from a script or alternatively is there a way to "import" a joboption files from script? (if nothing else works then suggestions for a dirty hack are also welcome)

Thanks in advance,

    Dirk

This topic has been closed for replies.

2 replies

Dirk MMBAuthor
Participant
February 16, 2011

Answered for now thus closed

John Hawkinson
Inspiring
February 15, 2011

Modifications to app.pdfExportPresets will create new items in the filesystem.

For instance, this code of ours goes to some extremes to make sure to clean up the .joboptions file that gets inadvertantly created:

var pdfPreset;

     pdfPreset = findLastItemRegexp(/^Mass Web /, app.pdfExportPresets); // private function

...

     if (spreads) {

       // Sadly, this actually creates a file in the filesystem, so we
       // need to be quite careful and not willy-nilly duplicate pdf
       // presets, etc.
       spreadPdfPreset = pdfPreset.duplicate();
       try {
            spreadPdfPreset.exportReaderSpreads = true;
            spreadPdfPreset.name = pdfPreset.name + " SPREADS";
            doPdfExport(spreadPdfPreset);
       } catch (e0) {
            alert("Caught "+e0.message+
            "while exporting PDF as spreads.");
       } finally {
            spreadPdfPreset.remove();
       }
      } else {
        doPdfExport(pdfPreset);
      }

Hopefully that's sufficient to get you going?

I guess it's not exactly what you want -- you want to import the JobOptions file externally, rather than construct it within your script -- hopefully this will help though.

Dirk MMBAuthor
Participant
February 16, 2011

Thanks for your answer. Indeed this was not exactly what I was looking for but this might come in useful someday too.

I think I found a solution to my problem... Setting the "Using" parameter of the Export method to the string name of the .joboptions file on disk instead of a look-upped Export Preset object seems to work, even if the PDF Export Presets collection in InDesign hasn't been synced to include the new item.