You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Venkatesh Prasad (JIRA)" <ji...@apache.org> on 2009/05/07 13:15:30 UTC
[jira] Updated: (PDFBOX-463) Not able to list fields
[ https://issues.apache.org/jira/browse/PDFBOX-463?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Venkatesh Prasad updated PDFBOX-463:
------------------------------------
Attachment: SIMPLEIRAApp.pdf
This is the file being accessed. I opened this file in Adobe Acrobat as well as checked whether this has permission to read/modify etc by using the following code:
String pdfSource = "SIMPLEIRAApp.pdf";
PDDocument document = PDDocument.load(pdfSource);
AccessPermission aPermit = new AccessPermission();
aPermit = document.getCurrentAccessPermission();
System.out.println(aPermit.canFillInForm());
System.out.println(aPermit.canModifyAnnotations());
The output for both was true.
> Not able to list fields
> -----------------------
>
> Key: PDFBOX-463
> URL: https://issues.apache.org/jira/browse/PDFBOX-463
> Project: PDFBox
> Issue Type: Bug
> Components: PDModel.AcroForm
> Affects Versions: 0.7.3
> Environment: Windows XP, JAVA jre6
> Reporter: Venkatesh Prasad
> Priority: Critical
> Attachments: SIMPLEIRAApp.pdf
>
> Original Estimate: 144h
> Remaining Estimate: 144h
>
> 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.
> 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.