You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Maruan Sahyoun (JIRA)" <ji...@apache.org> on 2015/07/12 23:30:04 UTC

[jira] [Commented] (PDFBOX-2873) Make bitfields public in PDField like in PDAnnotation

    [ https://issues.apache.org/jira/browse/PDFBOX-2873?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14624011#comment-14624011 ] 

Maruan Sahyoun commented on PDFBOX-2873:
----------------------------------------

One thing is to change the visibility of the flags.

On the other hand many of the changes we have done to the interactive.forms package PD model were to make sure that when working with the PD model there is no need to use the COS model (and abstract the user from knowing about which key to set, which values to use ...) . In fact where with 1.x methods parameters needed COS objects there are now basic Java objects such as String. The above code is a mixture of COS and PD.

Why not use {{field.setReadonly(true)}}?

> 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
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> 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: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org