2 Replies Latest reply on Jun 20, 2012 2:53 AM by kimmo242

    Exporting Secured PDF from indesign using apple script

    kimmo242 Level 1

      hi there, this is my first go at scripting,

      basically what i am trying to do is:

       

      tell indesign to turn on a layer called "proof" in the active document

       

      then export pdf - set pdf preference to smallest file size, all pages, and secure the file WITH A PASSWORD so that it can be opened but not edited (unless by someone at my agency who knows this password). this easy enough to manually, but im sick of typing out a password everytime i save a proof.

       

      then save to a specific folder on the desktop, using the already existing filename - so 'myfile.pdf'

       

      the code below gives me this message "

      error "Can’t make name of PDF export preferences into type Unicode text." number -1700 from name of «class DFpf» to Unicode text

       

      could someone please help me word this properly? I tried first referring to a pdf preset instead of setting all the values ie set color bitmap etc but i couldnt get the password to work,

      here is what i have so far, written from snippets that other people have tried:

       

      tell application "Adobe InDesign CS4"

                tell active document

        try

                                    set visible of layer "PROOF" to false

                          end try

        set docName to name

                          set baseName to text item 1 of docName

                          set ASTID to AppleScript's text item delimiters

                          set AppleScript's text item delimiters to "."

                          set AppleScript's text item delimiters to ASTID

                tell PDF export preferences

                          set acrobat compatibility to acrobat 4 --> create a 1.3 pdf

                          set use security to true

                          set disallow changing to true

                          set disallow copying to true

                          set disallow document assembly to true

                          set disallow extraction for accessibility to true

                          set disallow form fill in to true

                          set disallow notes to true

                          set disallow hi res printing to false

                          set color bitmap sampling DPI to 100

                          set grayscale bitmap sampling DPI to 100

                          set monochrome bitmap sampling DPI to 100

        --set image quality

                          set color bitmap quality to minimum

                          set grayscale bitmap quality to minimum

        --set fonts

                          set subset fonts below to 0

        --set security

                          set use security to true

                          set change security password to "editedit"

                          set disallow extraction for accessibility to false

                          set disallow copying to true

                          export format PDF type to "/Users/kimwilson242/Desktop/_PROOFS/" & name & ".pdf" without showing options

                end tell

      end tell

        • 1. Re: Exporting Secured PDF from indesign using apple script
          Muppet Mark Level 5

          tell application "Adobe InDesign CS5"

            -- prefs belong to app so use in tell app block

                    tell PDF export preferences

                              set acrobat compatibility to acrobat 4 --> create a 1.3 pdf

                              set use security to true

                              set disallow changing to true

                              set disallow copying to true

                              set disallow document assembly to true

                              set disallow extraction for accessibility to true

                              set disallow form fill in to true

                              set disallow notes to true

                              set disallow hi res printing to false

                              set color bitmap sampling DPI to 100

                              set grayscale bitmap sampling DPI to 100

                              set monochrome bitmap sampling DPI to 100

            --set image quality

                              set color bitmap quality to minimum

                              set grayscale bitmap quality to minimum

            --set fonts

                              set subset fonts below to 0

            --set security

                              set use security to true

                              set change security password to "editedit"

                              set disallow extraction for accessibility to false

                              set disallow copying to true

                    end tell

            -- now deal with the doc

                    tell active document

                              try

                                        set visible of layer "PROOF" to false

                              end try

                              set docName to name

                              set baseName to text item 1 of docName

                              set ASTID to AppleScript's text item delimiters

                              set AppleScript's text item delimiters to "."

                              set AppleScript's text item delimiters to ASTID

            -- use flexible path to user desktop… path strings are HFS (colon delimited)

                              export format PDF type to (path to desktop as text) & "PROOFS:" & name & ".pdf" without showing options

                    end tell

          end tell

          • 2. Re: Exporting Secured PDF from indesign using apple script
            kimmo242 Level 1

            Thank you so much Mark!!!!! getting a bit stuck on the proper order of things, sure ill get there after writing a few more and doing some more reading very much appreciated!!!!!