pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lukas Baab" <19lu...@web.de>
Subject How to remove form fields
Date Fri, 01 Feb 2013 08:47:18 GMT
Hi!

I want to remove all form fields from a PDF-document. But everything I try does not work.
Can you give me an advice?

Thanks and best regards
Lukas


Here are some attempts I tried but they did not work:

PDDocument pdDocument = PDDocument.load(new File("E:\\test.pdf"));
PDDocumentCatalog pdDocumentCatalog = pdDocument.getDocumentCatalog();
PDAcroForm pdAcroForm = pdDocumentCatalog.getAcroForm();
COSDictionary acroFormDict = pdAcroForm.getDictionary();

// pdDocumentCatalog.setAcroForm(null);

// acroFormDict.clear();

// COSArray fields = (COSArray) acroFormDict.getDictionaryObject(COSName.FIELDS);
// fields.clear();

// acroFormDict.removeItem(COSName.FIELDS);

pdDocument.save("E:\\test-result.pdf");


Mime
View raw message