SHARE
TWEET

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!
  1. (*
  2. ABOUT
  3. Select a number of pdf files to merge into one combined file.
  4. You can select non-contiguous files by holding down the command key.
  5. There's a second chance to select more files or you can just hit 'cancel' to continue
  6.  
  7. WRITTEN BY
  8. Applehelpwriter.com 2013
  9.  
  10. DISCLAIMER
  11. 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.
  12.  
  13. *)
  14.  
  15.  
  16. display dialog "Please choose the files to merge…" default button "OK"
  17. set inputFiles to choose file of type "PDF" with multiple selections allowed without invisibles
  18. delay 0.25
  19.  
  20. -- add more files if you wish, or press cancel to continue
  21. try
  22.         set inputFiles to inputFiles & (choose file of type "PDF" with prompt "add more?" with multiple selections allowed without invisibles)
  23. end try
  24.  
  25. --set the save location for the merged pdf
  26. display dialog "Please choose where to save the merged PDF…" default button "OK"
  27. set outputFolder to choose folder
  28. delay 0.25
  29.  
  30. --give the folder a name, don't add '.pdf' in the dialogue box
  31. display dialog "Type the name of the combined pdf: " default answer ""
  32. set theName to text returned of the result
  33. set outputFile to (outputFolder as text) & theName & "(" & (count of inputFiles) & ").pdf"
  34.  
  35.  
  36. set pdfFiles to ""
  37. repeat with p in inputFiles
  38.         set pdfFiles to pdfFiles & " " & quoted form of POSIX path of p
  39. end repeat
  40.  
  41.  
  42. do shell script "/System/Library/Automator/Combine\\ PDF\\ Pages.action/Contents/Resources/join.py " & "-o " & quoted form of POSIX path of outputFile & pdfFiles
  43. return outputFile as alias
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top