Hi All,

I am facing an issue in accessing an AcroForm after splitting a PDF.


*Scenario:*
In my PDF (contains sensitive data and hence cannot be shared), I have
fillable fields in multiple pages. I need to split the pages based on a
certain value in a certain field. When I try to get the AcroForm object on
the entire document, it works. But, when I split the document into pages
and try to access the AcroForm, it throws a null value.


*Test Steps:*
1. Load a fillable PDF (contains a single page with input field).
2. Split the PDF and get the first page as a PDDocument object.
3. Using the PDDocument object, I get the document catalog object.
4. Using the document catalog object, I
* try to get the acroform but it gives a null value.*


*Code-Snippet:*

*// get the PDF file*
File file = new File(pdfFilePath);

*// load the PDF file to memory*
PDDocument  pdfDocument = PDDocument.load(file);


*// initialize the splitter object and split the PDF object and get the 1st
page as a PDDocument object*
Splitter split = new Splitter();
PDDocument documentPage1 = split.split(document).get(0);

*// get the document catalog object of the splitted page*
PDDocumentCatalog docCatalog = documentPage1.getDocumentCatalog();

*// get the acroform of the document *
 PDAcroForm a = cat.getAcroForm();


*PDFBox Version:*2.0.9


Can we get the acroform for a single page in a PDF document? Let me know if
you have any analysis on this.

Thanks
Ankit
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to