User Guide    Working with PDFs    AppleScript and Automation

AppleScript and Automation

AppleScript

PDFpen includes extensive AppleScript support so that it's possible to automate the PDF manipulation process.

Example scripts are included with the application. Click on the AppleScript icon applescript in the menu bar to see the included scripts.

The first time you click the AppleScript icon, select Populate Scripts Menu to grant permission to copy the example scripts into the Application Scripts folder. Click on the AppleScript icon again to see and try the scripts.

PDFpen scripts are stored in:
[HOME]/Library/Application Scripts/com.smileonmymac.PDFpen

Combine PDFs
See Combining and Splitting.

Cover Fax Header
Cover up the unwanted header of a fax. Choose the amount of space below the top of the page that needs to be covered in increments of 72nds of an inch. Note that the header is not erased, merely covered with an opaque white rectangle.

Export Form Data…
Export to view the data generated from a filled-out form. Data is exported in .csv format, which can be changed by editing the AppleScript.

Imprint all Pages as First
Copy an imprint made on the first page of a document to all pages. Imprints are objects made with any annotation or drawing tool. (Imprints).

Imprint all Pages with Image
Place an image on all pages of a document. Click this option and a window opens to let you locate and select the image on your computer. To add a watermark, see Watermarks.

Imprint all Pages with Text
Place a selection of text in the center of each page of a document, e.g. Draft. To add a watermark, see Watermarks.

Merge Every Other
Combine odd and even page numbered PDFs. (Combining and Splitting).

Number Pages using Bates Numbering
Add page numbers using bates numbering. (Headers, Footers, and Page Numbers).

Number Pages
Add page numbers to your document. (Headers, Footers, and Page Numbers).

Remove All Imprints
Remove all imprint additions that you have made to a PDF. (Imprints).

Reverse Pages
Reverse the order of pages, so the last page is viewed first, and the first page is viewed last.

Split PDF
Divide a PDF, making each page a separate document.

Open Scripts Folder
To add a new script, quickly access the folder where scripts are stored.

You may view the application AppleScript dictionary by dragging the PDFpen application onto the Script Editor icon.

You may view the source of any script by holding the Option key and choosing the script from the AppleScript menu.

If you create a script you'd like to share with other PDFpen customers, please let us know. You're welcome to send such scripts to Support.

Automation

Automator Workflows (macOS 10.8 and later)

You can also place Automator workflows in the scripts folder. When selected, the frontmost PDF is the input for the Automator workflow. If you'd like the output to open in PDFpen, add a final Open Finder Items action set to Open with: Default Application, if PDFpen is your default PDF application, or set to Open with: PDFpen explicitly otherwise.

If you create a workflow you'd like to share with other PDFpen customers, let us know. Please send such workflows to Support.