pdfbox java.io.IOException: Page tree root must be a dictionary
示例代码
public static void main(String[] args) {
try (InputStream sampleInputs = new ClassPathResource("sample/untitle2.pdf").getInputStream();
PDDocument doc = PDDocument.load(sampleInputs, MemoryUsageSetting.setupTempFileOnly())) {
// get the document catalog
PDAcroForm acroForm = doc.getDocumentCatalog().getAcroForm();
// as there might not be an AcroForm entry a null check is necessary
if (acroForm != null) {
// Retrieve an individual field and set its value.
PDTextField field = (PDTextField) acroForm.getField("sampleField");
field.setValue("Text Entry");
// If a field is nested within the form tree a fully qualified name
// might be provided to access the field.
field = (PDTextField) acroForm