Roberto Nibali created PDFBOX-2873:
--------------------------------------
Summary: Make bitfields public in PDField like in PDAnnotation
Key: PDFBOX-2873
URL: https://issues.apache.org/jira/browse/PDFBOX-2873
Project: PDFBox
Issue Type: Improvement
Components: PDModel
Affects Versions: 2.0.0
Reporter: Roberto Nibali
Priority: Minor
I need to set COSName.FF and COSName.F dictionary entries to amend a broken
fields clone from one PDF to another. Here is part of the code to illustrate
what I'm trying to achieve:
String fieldToHideName = "01.024";
String fieldToShowName = "01.0251";
PDField fieldToHide =
tplDoc.getDocumentCatalog().getAcroForm().getField(fieldToHideName);
PDField fieldToShow =
tplDoc.getDocumentCatalog().getAcroForm().getField(fieldToShowName);
fieldToHide.getCOSObject().setFlag(COSName.F,
PDAnnotation.FLAG_HIDDEN, true);
fieldToShow.getCOSObject().setFlag(COSName.F,
PDAnnotation.FLAG_INVISIBLE, false);
fieldToShow.getCOSObject().setFlag(COSName.FF,
PDFields.FLAG_READ_ONLY, true);
The last one is not possible because the PDField's static flags are private
instead of public. I know there are methods to call, but I believe in this case
the resulting code is easier to read and more straight-forward to write. After
all we're talking about setting flags. For some reason the PDAnnotation's
static flags are public.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]