You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (JIRA)" <ji...@apache.org> on 2017/05/03 17:44:04 UTC
[jira] [Updated] (PDFBOX-3777) org.apache.pdfbox.cos.COSDictionary
cannot be cast to org.apache.pdfbox.cos.COSArray
[ https://issues.apache.org/jira/browse/PDFBOX-3777?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tilman Hausherr updated PDFBOX-3777:
------------------------------------
Component/s: AcroForm
> org.apache.pdfbox.cos.COSDictionary cannot be cast to org.apache.pdfbox.cos.COSArray
> ------------------------------------------------------------------------------------
>
> Key: PDFBOX-3777
> URL: https://issues.apache.org/jira/browse/PDFBOX-3777
> Project: PDFBox
> Issue Type: Bug
> Components: AcroForm
> Affects Versions: 2.0.5
> Reporter: John Liston
> Priority: Minor
> Attachments: D1790B.PDF
>
>
> public static void main(String[] args) {
> PDDocument pdDocument;
> try {
> pdDocument = PDDocument.load(new File("D1790B.PDF"));
> }
> catch (Exception e) {
> throw new RuntimeException(e);
> }
> PDAcroForm pdAcroForm = pdDocument.getDocumentCatalog().getAcroForm();
> if (pdAcroForm != null) {
> try {
> List<PDField> acroFields = pdAcroForm.getFields();
> List<PDField> pdFields = new ArrayList<PDField>();
> for (PDField pdField : acroFields) {
> // (modify fields)
> }
> pdAcroForm.setFields(pdFields);
> // flatten the document to get rid of the buttons
> pdAcroForm.flatten();
> }
> catch (IOException e) {
> throw new RuntimeException(e);
> }
> }
> }
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org