> I am trying to list form fields using the following code. There is no issue
> for a few PDF documents but for some I am getting the error -
> java.lang.NullPointerException.  
Please attach the whole stack trace, so that we have an idea what to look  for.

Andreas Lehmkühler

>               String pdfSource = "SIMPLE IRA App 1.828247.101 &  Ret Acct 
> Customer Agmt
> 1.830486.102 -- as of 6-6-08.pdf";
>               try {
> 
>               FileOutputStream outputObj;
>               PrintStream outputFile;
>                       String fileName = pdfSource.replace(".","_") + ".txt";
> 
>                       outputObj = new FileOutputStream(fileName);
>                       outputFile = new PrintStream(outputObj);
> 
>                       PDDocument document = PDDocument.load(pdfSource);
> 
>                       try {
>                               if (document.isEncrypted()) {
>                                       document.decrypt("");
>                               }
>                       } catch (Exception e) {
>                               System.out.println("Failed to decrypt document 
> #");
>                       }
> 
>                       List list = 
> document.getDocumentCatalog().getAcroForm().getFields();
>                       PDField pdfield;
> 
>                       for (int i = 0; i < list.size(); i++)
>                       {
>                               pdfield = (PDField) list.get(i);
>                               String fldName = pdfield.getPartialName();
>                               outputFile.println(fldName);
>                       }
>                       document.close();
>                       outputFile.close();
>               } catch (Exception e) {
>                       System.out.println("Error!" + e);
>               }
> 
> Please let me know what the issue is.
> 
> 
> -- 
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
> 
> 

--- original Nachricht Ende ----

Reply via email to