Created
August 5, 2013 04:07
-
-
Save bnchdrff/6153448 to your computer and use it in GitHub Desktop.
unlock PDFs using ghostscript. install gs from http://pages.uoregon.edu/koch/ before use.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- unlock PDFs with gs | |
-- licensed under public domain | |
-- copyright benjamin chodoroff 2013 | |
-- where is ghostscript binary? | |
property gs : "/usr/local/bin/gs" | |
on run | |
display dialog "drag n drop pdf unlocker" | |
end run | |
on open finder_objs | |
repeat with i from 1 to the count of finder_objs | |
set finder_obj to (item i of finder_objs) | |
set the finder_obj_info to info for finder_obj | |
if (alias of the finder_obj_info is false) and (the name extension of the finder_obj_info is "pdf") then | |
set finder_obj_abs_path to the POSIX path of finder_obj | |
do shell script gs & " -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile='" & finder_obj_abs_path & ".unlocked.pdf' -c .setpdfwrite -f " & finder_obj_abs_path | |
end if | |
end repeat | |
display dialog "unlocked " & i & " PDFs" | |
end open |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment