1 Reply Latest reply on Jul 21, 2011 12:37 PM by GoesStation

    On Startup: Open Document, Export as PDF (Print), Close


      I'm a software developer but I've rarely worked in JavaScript-like languages. I have a simple task I'd like to automate. The task will run infrequently -- maybe a dozen times on a busy day -- so performance isn't a priority.


      My application generates a customizable 8"x5" label which is attached to large tanks. Sometimes users want smaller versions of the label, 8-up on 8.5"x11" stock. Our graphics department has an InDesign document that works perfectly. The document uses the Place command to place my label PDFs eight times in exact locations. InDesign automatically crops to the visible boundary, so all I have to do is replace my PDF with a new one.


      I saved the graphic department's document as .idml which I edited to make the PDF paths relative rather than absolute. InDesign automatically regenerates the page when it opens the document.


      Now I want to use InDesign to automate this task. The server version would be serious overkill; all I need is a script that will run when the document opens on startup. The script has to export the document as PDF (for print) to a fixed filename, then close InDesign.


      An alternative would be to leave InDesign open, but I'd have to figure out how to send it an instruction to open the document, export it as PDF, then close the document.


      I think the first technique can be done with just a couple of lines of JS. Any sample code showing how to do it would be greatly appreciated.


      Thanks again,



        • 1. Re: On Startup: Open Document, Export as PDF (Print), Close
          GoesStation Level 1

          Here's a list of the actions the simplest script would have to implement:

          1. Run script on document open. Wait for PDF import to complete.
          2. File / Export...
          3. Save as type: Adobe PDF (Print)
          4. Enter file name
          5. Click "Save"
          6. Exit InDesign without saving document.


          The more complicated version would leave InDesign running between documents, using these actions:

          1. Open document
          2. Wait for PDF import to complete.
          3. File / Export...
          4. Save as type: Adobe PDF (Print)
          5. Enter file name
          6. Click "Save"
          7. Close document without saving it.


          Thanks again for any guidance,