20 Replies Latest reply on Apr 26, 2015 6:18 PM by eboda_snaf

    [JS][CS4/CS5] Images dropping off in scripted pdf export

    absqua Level 4

      I've encounted a bug that I wonder if someone could try to replicate or suggest a workaround of some sort for.


      Some background: we often need to batch-export a number of versioned InDesign files to pdf. These files will often share a lot of content, particularly placed images. We've used Peter Kahrel's export script for this purpose, as well as a number of scripts of my own. The specifics of the script don't seem to be important. I've seen the problem in both CS4 and CS5 on the Mac.


      The problem: Placed Illustrator files (and pdfs) drop off of exported pdfs, without any kind of error being raised, after a user tries to interact with InDesign while it's tied up during a script which opens and exports one file after another. Once an image drops off, it will be missing from every subsequently exported pdf until the script completes. The pdfs are valid—they open and display just fine—they just don't contain all the images they're supposed to. Placed raster images are not affected.


      If anyone cares to try to replicate this for me, the script I used to trigger it was:


      var f = File("/path/to/InDesign/file.indd"),
          d = Folder("/path/to/export/directory"),
          e = 0,
          i = 1000,
          doc, pdf;
          doc = app.open(f);
          pdf = File(d.fullName + "/" + f.displayName.replace(/\.indd$/,"") + e + ".pdf");


      The InDesign file can simply be a single page with any (as far as I know) placed Illustrator file or pdf. I used an .ai file with one black rectangle in the middle of the page.


      After getting the export script going in the ESTK, I Command-Tab over to InDesign. As soon as I try to click on any UI element (which will get me a spinning beach ball), the placed vector image drops off of the exported pdf and stays dropped off until I stop the script.


      While the solution seems simple—don't mess with InDesign while it's batch exporting pdfs—it's easy to forget that it's tied up, and the consequences of an image silently dropping off of an exported pdf could be quite dire.


      Thanks in advance.