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

Petr Slaby commented on PDFBOX-2692:
------------------------------------

Basically, that means I have to re-implement the PageDrawer by myself, or? I 
need all of its functionality, including transparency groups and all the other 
logic it contains. I just need to intervene in showFontGlyph, or even 
drawGlyph2D to tell to the target renderer "draw a character" instead of "fill 
path" - if the renderer is capable of handling fonts. So in the end, I would 
copy/paste the whole PageDrawer, make the copy non-final, inherit from it and 
override one or two methods. I am fine with that - after all, we have copied 
the whole PDFBox source in 1.8.x. But at the moment, not even that is possible 
as TilingPattern and Glyph2D and its implementations are not public. Meaning I 
would have to copy/paste even more classes.

Our target format renderers already have a Graphics2D implementation, passing 
it to PageDrawer.drawPage() is a perfect fit. I "just" need something 
corresponding to Graphics2D.drawGlyphVector() to be called instead of 
graphics.fill() when rendering a character. E.g. declare a special public 
interface, having methods like drawGlyph and fillGlyph with the parameters 
being PDFont, Glyph2D (or the GeneralPath it produces, but without the 
transformation being applied), character code and the transformation. The 
methods would be called instead of graphics.fill() or graphics.draw() in 
drawGlyph2D() if the graphics instance implements the interface. Passing 
Glyph2D instead of GeneralPath should be faster as my renderers only need the 
GeneralPath once for each character to create it in the on-the-fly font.

> Possibility to use our own and/or overwrite PageDrawer class
> ------------------------------------------------------------
>
>                 Key: PDFBOX-2692
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2692
>             Project: PDFBox
>          Issue Type: Wish
>          Components: Rendering
>    Affects Versions: 2.0.0
>         Environment: JDK 1.8, Windows 7, PDF-Box - current trunk
>            Reporter: Manfred Pock
>            Assignee: Andreas Lehmkühler
>              Labels: features
>             Fix For: 2.0.0
>
>         Attachments: pdfexample.jpg
>
>
> We use PDFBox to render PDF's. Additionally, we have the posibility to add 
> different kinds of annotation (stamp, marks, free text, notes..) like in a 
> wysiwyg-editor. To do this, it is necessary that we paint these annotations 
> on our own.
> Another reason is not to paint all parts: for example we have a pdf with an 
> embedded picture. Behind the picture we have the OCR-text to this picture. 
> This text is only needed for searching und should not be painted.
> Thus it would be useful to use our own derived PageDrawer. As I see there are 
> some things to change.
> a.) remove the final from PagerDrawer-class.
> b.) make some global-variables (graphics, xform, pageSize...) protected,
> c.) also some methods like setRenderingHints should be protected
> d.) maybe the possibility to say to the PDFRender which PageDrawer should be 
> used.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org

Reply via email to