I am using the PDFBox 2.0.8 and trying to use command line options supplied to a jar file for PDF decryption. There are couple of PDF files which result in error saying those can only be decrypted with owner password (okay) however I was able to remove the PDF password with online tool which uses QPDF I guess. Now my concern is can I just use some same option with PDFBox to decrypt the PDF with out worrying about owner/user password reservations? (I guess YES, because the same password is able to open the PDF with Acrobat as well as save the decyrpted PDF copy by supplying the same password). My current command line example
java -jar "D:\pdfbox.jar" Decrypt -password xxxxxxxx "D:\uploads\Jjre2pJsC-7KerheiZ8OUt079E7d4dlS.pdf"
The exception I am getting:
2018-06-13 - 09:52:30 - error: SaveDecryptedPDF > Failed > Error: Command failed: java -jar "D:\pdfbox.jar" Decrypt -password xxxxxxxx "D:\uploads\Jjre2pJsC-7KerheiZ8OUt079E7d4dlS.pdf" Exception in thread "main" java.io.IOException: Error: You are only allowed to decrypt a document with the owner password. at org.apache.pdfbox.tools.Decrypt.decrypt(Decrypt.java:154) at org.apache.pdfbox.tools.Decrypt.main(Decrypt.java:64) at org.apache.pdfbox.tools.PDFBox.main(PDFBox.java:52)
Can you folks please suggest if I can achieve decryption without the constraint of owner/user password, if I have a valid PDF password and I am able to open the PDF file by manually supplying the password in and PDF reader application.