Hi,
I am trying to populate the PRAcroForm fieldsByName hash map by calling readAcroForm function
Below is my code snippet:
itext::PRAcroForm* vfc_acroform = (itext::PRAcroForm*)vfcreader->getPdfObject(vfc_catalog->get(itext::PdfName::ACROFORM));
itext::PRAcroForm* form = new itext::PRAcroForm(vfcreader);
form->readAcroForm((itext::PdfDictionary*)vfc_acroform);
My code execution fails with the following error message:
Unhandled Java Exception:
java.lang.ClassCastException: com.lowagie.text.pdf.PRIndirectReference cannot be cast to com.lowagie.text.pdf.PdfArray
at _Jv_CheckCast (/usr/lib/libgcj.so.5.0.0)
at com.lowagie.text.pdf.PRAcroForm.iterateFields
(com.lowagie.text.pdf.PdfArray, com.lowagie.text.pdf.PRIndirectReference, java.lang.String) (Unknown Source)
at com.lowagie.text.pdf.PRAcroForm.readAcroForm(com.lowagie.text.pdf.PdfDictionary) (Unknown Source)
at TK_Session.create_output() (/pdftk-
1.41/pdftk/pdftk.cc:2153)
at main (/pdftk-1.41/pdftk/pdftk.cc:2796)
at __libc_start_main (/lib/tls/libc-
2.3.4.so)
at java.awt.Component.firePropertyChange(java.lang.String, boolean, boolean) (/pdftk-
1.41/pdftk/pdftk)
I traced the code which causes this exception as follows:
PdfArray kids = (PdfArray)dict.get(PdfName.KIDS);
Please let me know what might be the cause of this runtime error.
Thanks,
Pradeepa