pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tilman Hausherr <THaush...@t-online.de>
Subject Re: org.apache.pdfbox.exceptions.WrappedIOException
Date Wed, 06 Apr 2016 17:54:35 GMT
Hi,

Could you 1) upload the PDF somewhere (attachments don't go through) and 
2) use this code:

PDDocument doc = PDDocument.loadNonSeq(new File(...));

then the rest

pdDocumentCatalog = pdDocument.getDocumentCatalog();
                 
                 pdAcroForm = pdDocumentCatalog.getAcroForm();




Current 1.8 version is 1.8.11.

Tilman

Am 06.04.2016 um 19:50 schrieb Strein, Mark C CIV USARMY TRADOC ANALYSIS 
CTR (US):
> Hello all,
>
> Need a bit of help.
>
> I was using:
> Java 7
>   pdfbox 1.8.6(source),
> bcmail-jdk15-1.44.jar,
> bcprov-jdk15-1.44.jar,
> commons-logging-1.1.2.jar,
> fontbox-1.8.6.jar,
> jempbox-1.8.6.jar
>
> "
> pdDocument = PDDocument.load(pdfFileName);
>                  
>                  isFormEncrypted = pdDocument.isEncrypted();
>                  
>                  if(isFormEncrypted&&allowEncrypted)
>                  {
>                      try
>                      {
>                          pdDocument.decrypt("");
>                      }
>                      catch(CryptographyException e)
>                      {
>                          e.printStackTrace();
>                      }
>                      catch(InvalidPasswordException e)
>                      {
>                          e.printStackTrace();
>                      }
>                  }
>                  
>                  pdDocumentCatalog = pdDocument.getDocumentCatalog();
>                  
>                  pdAcroForm = pdDocumentCatalog.getAcroForm();
> "
> The above will open the attached PDF and I can fill it as normal.
>
>
> When I use:
> Java 8,
> pdfbox-1.8.10-src
> bcmail-jdk16-1.46.jar
> bcprov-jdk16-1.46.jar
> commons-logging-1.1.2.jar
> fontbox-1.8.10.jar
> jempbox-1.8.10.jar
> icu4j.jar
>
> "
> 	File originalPDF = new File(pdfFileName);
>                  PDFParser parser = new PDFParser(new BufferedInputStream(new FileInputStream(originalPDF)));
>                  parser.parse();
>                  pdDocument = parser.getPDDocument();
>
>                  boolean isOriginalDocEncrypted = pdDocument.isEncrypted();
>                  if (isOriginalDocEncrypted)
>                  {
>                  	pdDocument.openProtection(new StandardDecryptionMaterial(""));
>                  }
>                  pdDocumentCatalog = pdDocument.getDocumentCatalog();
>                  
>                  pdAcroForm = pdDocumentCatalog.getAcroForm();
> "
>
> I get this error,
>
> Apr 06, 2016 12:32:01 PM org.apache.pdfbox.pdfparser.PDFParser parse
> INFO: Document is encrypted
> Error occured when trying to load the PDF file: ./Forms/blankDA3161.pdf
> org.apache.pdfbox.exceptions.WrappedIOException
> 	at org.apache.pdfbox.pdmodel.encryption.SecurityHandler.encryptData(SecurityHandler.java:376)
> 	at org.apache.pdfbox.pdmodel.encryption.SecurityHandler.decryptString(SecurityHandler.java:578)
> 	at org.apache.pdfbox.pdmodel.encryption.SecurityHandler.decrypt(SecurityHandler.java:430)
> 	at org.apache.pdfbox.pdmodel.encryption.SecurityHandler.decryptDictionary(SecurityHandler.java:531)
> 	at org.apache.pdfbox.pdmodel.encryption.SecurityHandler.decrypt(SecurityHandler.java:438)
> 	at org.apache.pdfbox.pdmodel.encryption.SecurityHandler.decryptObject(SecurityHandler.java:404)
> 	at org.apache.pdfbox.pdmodel.encryption.SecurityHandler.proceedDecryption(SecurityHandler.java:222)
> 	at org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.decryptDocument(StandardSecurityHandler.java:158)
> 	at org.apache.pdfbox.pdmodel.PDDocument.openProtection(PDDocument.java:1609)
> 	at lib.TRACJavaLibrary.io.formFile.FormFileManager$PDFFileManager.<init>(FormFileManager.java:921)
> 	at lib.TRACJavaLibrary.io.formFile.FormFileManager.<init>(FormFileManager.java:118)
> 	at lib.TRACJavaLibrary.io.formFile.FormFileManager.<init>(FormFileManager.java:82)
> 	at src.utility.DA3161.<init>(DA3161.java:51)
> 	at src.utility.PDF3161.<init>(PDF3161.java:23)
> 	at src.userInterface.HRPanel.getDA3161(HRPanel.java:1929)
> 	at src.userInterface.HRPanel.createDA3161(HRPanel.java:2225)
> 	at src.application.Main$19.actionPerformed(Main.java:890)
>
>
>
> Any ideas as to why I could open this using the older stuff and I can't open it with
the newer stuff?
> Please note that I do not know the owner or user password.... I didn't need it before,
and I don't think HQA G6/8 is going to give me the passwords even if I ask nice.
>
> Can you guys open it using the latest code?
>
>
> V/R,
> Mark Strein
>
> TRAC-FLVN
> Wargaming and Simulations Directorate
> Analytic Tools Division - Paving Crew
> Keeper of the Codes
> 913-684-9309
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message