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

John Hewson edited comment on PDFBOX-2333 at 5/14/15 10:25 PM:
---------------------------------------------------------------

I noticed that AppearanceGenerator contains only one method and that method is 
simply a giant if-then based on the instanceof PDField, implementing different 
functionality for each subclass. This is of course, inheritance, only 
implemented backwards. I've split this method up and moved it into the existing 
PDField class model as constructAppearances(), so that class-specific 
functionality is implemented within the classes themselves instead of having 
AppearanceGenerator "peering through" the PDField abstraction by systematic use 
of instanceof.

I've also split the field updating into applyChange(), which calls 
constructAppearances(), this is to allow "onChange" events to be raised when 
the field is updated, which will be needed if we implement cascading or 
JavaScript in the future.


was (Author: jahewson):
I noticed that AppearanceGenerator contains only one method and that method is 
simply a giant if-then based on the instanceof PDField, implementing different 
functionality for each subclass. This is of course, inheritance, only 
implemented backwards. I've split this method up and moved it into the existing 
PDField class model as constructAppearances(), so that class-specific 
functionality is implemented within the classes themselves instead of having 
AppearanceGenerator "peering through" the PDField abstraction by systematic use 
of instanceof.

> Overhaul the appearance generation for PDF forms
> ------------------------------------------------
>
>                 Key: PDFBOX-2333
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2333
>             Project: PDFBox
>          Issue Type: Improvement
>          Components: AcroForm
>    Affects Versions: 2.0.0
>            Reporter: Maruan Sahyoun
>            Assignee: Maruan Sahyoun
>            Priority: Critical
>             Fix For: 2.0.0
>
>         Attachments: AcroForms-SimpleTextFields.1.8.7.pdf, 
> AcroForms-SimpleTextFields.1.8.7.png, AcroForms-SimpleTextFields.pdf, 
> AlignmentTests-post1633495.pdf, AlignmentTests-pre1633495.pdf, 
> MultilineTests-filled-post1677712.png, MultilineTests-filled-pre1677712.png, 
> MultilineTests-prePatch.pdf
>
>
> The appearance handling for forms in 1.x is limited and does not reflect all 
> settings possible for form fields. In addition the current code is not very 
> modular and does not follow the box model used for form fields. 
> Unfortunately only the basics of form handling are defined in the PDF spec. 
> The details like padding of boxes, text placement etc. have to be determined 
> by looking at how Adobe forms are generated.
> Update: The file from PDFBOX-2310 has bad rendering which might be related?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to