HomeScripting PDFClerk ProScripting PDFClerk ProIndex
  PDFClerk Pro > Scripting PDFClerk Pro Index

AppleScript

PDFClerk Pro is largely, but not fully scriptable with Applescript (and Ruby, and Python using the appropriate scripting bridges). Scripters should consult the PDFClerk Pro scripting dictionary to inform themselves of its scripting capabilities.

Documents and imposition templates are mostly scriptable. Watermarks are not yet scriptable although this is likely to follow in a later release.

Some sample scripts:

Selecting and marking up text

tell application "PDFClerk Pro"
     tell document 1
          select from character 2501 through character 3400
          strike through selection
          select occurrences of "good"
          underline selection with color {35535, 35000, 65535}
          tell page 2
               select occurrences of "fantastic"
               highlight selection
          end tell
          set x to every page whose unstyled text body contains "some text"
     end tell
end tell
Managing Annotations

tell application "PDFClerk Pro"
     --set scriptingAlias to alias "/Users/antonionunes/Desktop/scripting.pdfp"
     set scriptingAlias to alias "Narayan:Users:antonionunes:Desktop:scripting.pdfp"
     open scriptingAlias
     tell document 1
          set p1 to page 1
          set p2 to make new page with properties {label:"kha"}
          tell p1
               set link 1 to the first dynamic annotation
               tell the mouse up action of the first dynamic annotation to set the destination to {target page:p1, target point:{11, 12}}
               set d0 to the destination of the mouse up action of the first dynamic annotation
               tell the first dynamic annotation
                    set theAction to the mouse up action
                    set actionClass to the class of theAction
                    set t to the action type of theAction
                    if t is "URL" or t is "URI" then
                         set u to the URL of theAction
                    else if t is "GoTo" then
                         tell theAction
                              set the destination to {target page:p2, target point:{7, 9}}
                              set d1 to the destination
                              set the destination to {target page:p1, target point:{100, 250}}
                              set d2 to the destination
                         end tell
                    else if t is "GoToR "then
                         set pageIndex to the page index of theAction
                         set pt to the point of theAction
                         set u to the URL of theAction
                         set the point of theAction to {10, 20}
                    endif
               end tell
          endtell
     end tell
end tell
Some dynamic annotation creation commands

set rect1 to make new dynamic rectangle with properties
     {bounds:{100, 100, 80, 120}, border style:dashed, line width:9, dash pattern:{5, 2, 9, 2}}

set oval1 to make new dynamic oval with properties
     {bounds:{200, 100, 80, 120}, interior color:orangeColor}

set line1 to make new dynamic line with properties
     {bounds:{200, 100, 80, 120}, modification date:(current date) - 9 * minutes, should display:yes, should print:no, color:{30000, 10000, 60000}, contents:"Hello world!"}

set line2 to make new dynamic line with properties
     {bounds:{300, 100, 80, 120}, start point:{10, 20}, end point:{80, 118}, shape start:square, shape end:closed arrow, interior color:{30000, 10000, 40000}, line width:9.25}

set choice1 to make new choice widget with properties
     {bounds:{400, 20, 80, 120}, background color:orangeColor, choices:{"1", "2", "Haha"}, choice:"Haha", field name:"My field name", show as list:yes, font color:orangeColor}

set button to make new button widget with properties
     {bounds:{400, 20, 80, 120}, field name:"My field name", font color:orangeColor, caption:"Carnation", control type:push button, state:0, on state value:"Nice!"}

set ftext to make new note widget with properties
     {bounds:{40, 400, 64, 64}, contents:"Please open the door.", icon type:key icon}

set formField to make new form field with properties
     {bounds:{40, 400, 164, 24}, maximum length:4, string value:"My default", field name:"R2d2"} delete formField
Sorting pages

tell application "PDFClerk Pro"
     tell document 1
          sort pages by label value direction descending
          sort pages by label value direction ascending
          sort pages by source name value direction ascending
     end tell
end tell
Creating a link to an internal page

tell the mouse up action of the first dynamic annotation to set the destination to
     {target page:p1, target point:{11, 12}}

Copyright © SintraWorks
Dernière mise à jour le 22 juin 2015

HomeScripting PDFClerk ProScripting PDFClerk ProIndex