1 Reply Latest reply on Dec 9, 2010 6:42 AM by Dave Merchant

    Duplex Printing, needs pdf to end in even

    X_type0

      I have a pdf document that has multiple bookmarks within it, so for example multiple chapters of a book and each chapter has a cover page.

       

      Is there a way of using Acrobat and batch processing/javascript so that I can make each chapter cover page print on a new page if the whole pdf is being printed w/ duplex or through script to add an extra page before the new chapter page if it is on an even page number?

       

      There are many chapters so just inserting a page manually is not quite feasible and the pdf is coming out of a reporting system that we can't change to force it to add an extra page.

       

      Thanks.

        • 1. Re: Duplex Printing, needs pdf to end in even
          Dave Merchant MVP & Adobe Community Professional

          yes it's possible, provided you're opening it in Acrobat and not Reader - however it's a nasty code to write as there's no inbuilt way to read the destination page number of a bookmark using the API.

           

          I don't have a script to hand for your specific case, but the pseudo-code for a batch process command would be along the lines of;

           

          - load the bookmarks using the doc (this).bookmarkRoot object and traverse through the children thereof looking for those which demark a chapter.

          - execute each bookmark in turn, so the script can make a note of the destination page each one points to, for example in an array.

          - decide if the page counts between each chapter mean the chapter will end on a verso page.

          - if not, use the doc (this).newPage() command to insert a blank page between the two chapters.

          - repeat for each bookmark excluding the last one.

           

           

          Snippet example to add a blank page between pages 13 and 14 (note the newPage command uses a 1-based numbering system, unlike other JSAPI commands):

           

          var Rect = this.getPageBox("Crop");
          var atPage = 13;
          this.newPage(atPage, Rect[2], Rect[1]);
          1 person found this helpful