4 Replies Latest reply on Nov 26, 2009 2:46 PM by sstanleyau

    [AS] Get bounds of PDF before it is placed

    Kevin Parrott Level 2

      Hi

       

      I have a PDF which is chosen via a list, from this list I place the PDF into my ID document.

       

      My question is, how can I/do I  get the geometric bounds of the PDF before it is placed?

       

          tell application "Finder"
                      set _list to name of items of folder _path whose name ends with ".pdf"
                      activate
                      choose from list _list with prompt "Select PDF" default items item 1 of _list
                      set userchoice to item 1 of the result
                      set _itempath to _path & userchoice
                      set _itemalias to alias _itempath
                      set PicList to _itemalias
                  end tell

       


      tell application "Adobe InDesign CS4"
          activate
          set x to (display dialog "How many pages to place:" with icon caution buttons {"1", "2", "Cancel"} default button 1)
          if button returned of x is "1" then
              set page number of PDF place preferences to 1
              set PDF crop of PDF place preferences to crop bleed -- content, art, PDF, trim, bleed, media
              set transparent background of PDF place preferences to true
              tell document 1
                  place PicList as alias on page 1
                  fit rectangle 1 given center content
              end tell
          end if
      end tell

       


      Cheers
      Kev