Reproduzierbares Beispiel:
Code: Select all
PDDocument document = new PDDocument();
PDPage page = new PDPage(PDRectangle.A4);
// Create AcroForm
PDAcroForm acroForm = new PDAcroForm(document);
document.getDocumentCatalog().setAcroForm(acroForm);
// Create a single text field
PDTextField textField = new PDTextField(acroForm);
textField.setPartialName("testField");
PDAnnotationWidget widget = textField.getWidgets().get(0);
widget.setRectangle(new PDRectangle(100, 700, 200, 20));
widget.setPage(page);
page.getAnnotations().add(widget);
acroForm.getFields().add(textField);
// Adding page AFTER creating form fields causes StackOverflowError
document.addPage(page);
document.save("output.pdf");
document.close();
PDFBox-Version: 3.0.5
Code: Select all
java.lang.StackOverflowError
at org.apache.pdfbox.cos.COSDictionary.getIndirectObjectKeys(COSDictionary.java:1495)
at org.apache.pdfbox.cos.COSDictionary.getIndirectObjectKeys(COSDictionary.java:1490)
at org.apache.pdfbox.cos.COSArray.getIndirectObjectKeys(COSArray.java:842)
at org.apache.pdfbox.cos.COSDictionary.getIndirectObjectKeys(COSDictionary.java:1495)
at org.apache.pdfbox.cos.COSDictionary.getIndirectObjectKeys(COSDictionary.java:1490)
at org.apache.pdfbox.cos.COSArray.getIndirectObjectKeys(COSArray.java:842)
[repeating pattern...]
Mobile version