itext pdf decryption using user password
In itext, can we decrypt a pdf file using the user password that was used to encrypt the file?
I know decryption can be done using owner password. What I want to achieve is:
In my web application, keep pdf files in encrypted form. When the authorized user requests for a pdf file, then depending on the permissions (user's role), I send them a file with appropriate permissions - ALLOW_PRI开发者_JAVA技巧NTING, ALLOW_COPY etc.
What I am doing right now is I encrypt a file using OWNER and USER passwords and then decrypt it using OWNER password but then that file allows all actions - print, copy etc.
Please help.
Thanks, Deepak
So far, I follow this page: http://www.cyberciti.biz/faq/removing-password-from-pdf-on-linux/
And the tool qpdf works with only user password. Hope this would help you.
For decryption, you can use PDFBox, see my answer here : https://stackoverflow.com/a/9976481/535203
I give a sample code to decrypt a PDF given its password.
精彩评论