merge PDFs in OS X
applehelpwriter Mar 23rd, 2013 1,684 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- Select a number of pdf files to merge into one combined file.
- You can select non-contiguous files by holding down the command key.
- There's a second chance to select more files or you can just hit 'cancel' to continue
- WRITTEN BY
- Applehelpwriter.com 2013
- This script is provided in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.
- display dialog "Please choose the files to merge…" default button "OK"
- set inputFiles to choose file of type "PDF" with multiple selections allowed without invisibles
- delay 0.25
- -- add more files if you wish, or press cancel to continue
- set inputFiles to inputFiles & (choose file of type "PDF" with prompt "add more?" with multiple selections allowed without invisibles)
- end try
- --set the save location for the merged pdf
- display dialog "Please choose where to save the merged PDF…" default button "OK"
- set outputFolder to choose folder
- delay 0.25
- --give the folder a name, don't add '.pdf' in the dialogue box
- display dialog "Type the name of the combined pdf: " default answer ""
- set theName to text returned of the result
- set outputFile to (outputFolder as text) & theName & "(" & (count of inputFiles) & ").pdf"
- set pdfFiles to ""
- repeat with p in inputFiles
- set pdfFiles to pdfFiles & " " & quoted form of POSIX path of p
- end repeat
- do shell script "/System/Library/Automator/Combine\\ PDF\\ Pages.action/Contents/Resources/join.py " & "-o " & quoted form of POSIX path of outputFile & pdfFiles
- return outputFile as alias
RAW Paste Data