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

Maruan Sahyoun commented on PDFBOX-3353:
----------------------------------------

On a high level - none I'm aware of. In detail there are some as we (I) would 
really like to replicate some of the behavior Adobe Acrobat has. 

Talking about annotations some operators are only emitted on certain 
conditions. E.g. color setting is done using the grayscale operators (wo a CS 
operator) where if we use the generic {{setColor(PDcolor)}} we get a different 
output. Also {{PDPageContentStream}} tends to complain if a color space hasn't 
been set although it's not common to have one in an annotation appearance 
stream. Not that it should matter as the end result should be the same but 
comparing the appearance stream will show different results. In addition we 
have multiple constructors to deal with the different content stream sources 
where at the end we would only need an output stream to write to.

The current {{PDPageContentStream}} also does some state handling which is 
beneficial for a page content stream but not something which is really needed 
for the current state of appearance generation. In fact some of the extra code 
in {{PDAbstractContentStream}} and {{PDAppearanceContentStream}} was done to 
have extra methods to get by the state handling.

Finally it would be good to have higher level reusable functions which - again 
at this time - are specific to annotations such as drawing rectangles or 
circles which builds on top of PDAbstractContentStream.

That's why I think a decorator is more suitable than extending and might help 
keep the individual classes limited to their main purpose i.e. we could reduce 
the complexity of {{PDAbstractContentStream}} and move specific stuff into 
{{PDPageContentStream}} and {{PDAppearanceContentStream}} where 
{{PDPageContentStream}} has a much broader set of functionalities.

I'm using the current class names here which should not mean that the current 
structure is carved in stone - so they are for illustration. We could also 
decide to use the current {{PDPageContentStream}} class and build on that, but 
I think that's less flexibel.

> Create appearance streams for annotations
> -----------------------------------------
>
>                 Key: PDFBOX-3353
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3353
>             Project: PDFBox
>          Issue Type: Task
>          Components: PDModel, Rendering
>    Affects Versions: 1.8.12, 2.0.0, 2.0.1, 2.0.2, 2.1.0
>            Reporter: Tilman Hausherr
>              Labels: Annotations
>         Attachments: PDFBOX-3353-highlight-noAP-001796-p1.pdf, 
> PDFBOX-3353-highlight-noAP.pdf, SquareAnnotations.pdf, showAnnotation.java
>
>
> Create appearance streams for annotations when missing.
> I'll start by replacing current code for Ink and Link annotations.
> Good example PDFs:
> http://www.pdfill.com/example/pdf_commenting_new.pdf
> https://github.com/mozilla/pdf.js/issues/6810



--
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