0

I'm trying to open this PDF File to automate form filling: DA1059

PDFtk, PDFBox, Chrome's PDF Viewer, and the Mac OSX preview app all fail to open the PDF.

However, Adobe Reader or Acrobat successfully open the PDF without prompting for a password.

PDFtk errors out with:

$ pdftk da1059.pdf dump_data_fields
Error: Failed to open PDF file:
   da1059.pdf
   OWNER PASSWORD REQUIRED, but not given (or incorrect)
Done.  Input errors, so no output created.

PDFBox errors out with:

$ java -jar pdfbox-app-1.8.9.jar ExtractText da1059.pdf
Jul 15, 2015 10:41:38 PM org.apache.pdfbox.pdfparser.PDFParser parse
INFO: Document is encrypted
ExtractText failed with the following exception:
org.apache.pdfbox.exceptions.WrappedIOException
    at org.apache.pdfbox.pdmodel.encryption.SecurityHandler.encryptData(SecurityHandler.java:375)
    at org.apache.pdfbox.pdmodel.encryption.SecurityHandler.decryptString(SecurityHandler.java:577)
    at org.apache.pdfbox.pdmodel.encryption.SecurityHandler.decrypt(SecurityHandler.java:429)
    at org.apache.pdfbox.pdmodel.encryption.SecurityHandler.decryptDictionary(SecurityHandler.java:530)
    at org.apache.pdfbox.pdmodel.encryption.SecurityHandler.decrypt(SecurityHandler.java:437)
    at org.apache.pdfbox.pdmodel.encryption.SecurityHandler.decryptObject(SecurityHandler.java:403)
    at org.apache.pdfbox.pdmodel.encryption.SecurityHandler.proceedDecryption(SecurityHandler.java:221)
    at org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.decryptDocument(StandardSecurityHandler.java:158)
    at org.apache.pdfbox.pdmodel.PDDocument.openProtection(PDDocument.java:1602)
    at org.apache.pdfbox.ExtractText.startExtraction(ExtractText.java:216)
    at org.apache.pdfbox.ExtractText.main(ExtractText.java:85)
    at org.apache.pdfbox.PDFBox.main(PDFBox.java:58)
Caused by: javax.crypto.BadPaddingException: Given final block not properly padded
    at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:966)
    at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:824)
    at com.sun.crypto.provider.AESCipher.engineDoFinal(AESCipher.java:436)
    at javax.crypto.Cipher.doFinal(Cipher.java:2004)
    at org.apache.pdfbox.pdmodel.encryption.SecurityHandler.encryptData(SecurityHandler.java:351)
    ... 11 more

Tilman Hausherr pointed out it's an XFA form. There's a couple of related questions on Stack Overflow:

Combining XFA with PDFBox

I started a minimal working example at https://github.com/jschaf/pdfxfa.

Not Supported

Working with XFA and certified forms in PDFBox depends on incremental update which is currently not supported. See PDFBOX-2859 Support for Incremental Update.

Community
  • 1
  • 1
Joe
  • 3,370
  • 4
  • 33
  • 56

0 Answers0