AppleScript C Perl Shell Xcode Other

Using Ghostscript to remove PDF password protection

Post Reply
coding / shell     Views: 3180Prev .. Next
Using Ghostscript to remove PDF password protectionPosted: Monday, June 9, 2014 [22:20:13] - 1
rootPosted by:rootMember Since:
June 16 2010
Posts: 128
In case you forgot password for your password protected PDF file there are number of commercially available programs.
Good news - your Mac has built-in program to solve the issue within a minute or two: Ghostscript
Ghostscript will work on file password protection, not encrypted files. Terminal command is:
View Codegs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -o /path_to/output.unlocked.file.pdf /path_to/password.protected.pdf

Ghostscript will create PDF v1.4 file which is readable by PDF::API2 Perl module if file was built by Adobe Acrobat in v1.5There's no place like ~
RE: Using Ghostscript to remove PDF password protectionPosted: Thursday, June 12, 2014 [07:02:43] - 2
rootPosted by:rootMember Since:
June 16 2010
Posts: 128
Forgot to mention one more important detail: GhostScript WILL actually remove cropped content from input PDF file unlike Adobe Acrobat software. Acrobat will only mask cropped content from the view.
So if you have cropped PDF in Adobe Acrobat Pro or any other software, to actually remove the cropped content GhostScript is the tool to use on saved document.

How it works:
1. Using Acrobat software crop the document content
2. Save PDF file in Acrobat
3. Run the GhostScript in Terminal

Check the newly created PDF file in your Acrobat Pro (Document -> Examine Document...) - cropped content is gone.

enjoyThere's no place like ~
coding / shellPrev .. Next
 
Post Reply
Home - Coding: AppleScript C Perl Shell Xcode Other