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

John Hewson commented on PDFBOX-2692:
-------------------------------------

The only outstanding issue is Daniel Wilson's use case, which is as follows:

{quote}
It's software used by the embroidery and screen print industries. There's a 
color editor in it. Users select a color and turn a group of letters or a 
design element a different color. We have no desire to edit the underlying 
Adobe Illustrator file (which uses the PDF spec. But we do want to show the 
artwork with a different color applied.
{quote}

Having given it some thought, it seems that Andreas' suggestions won't be 
enough to implement this, at a minimum 'graphics' will need to be made 
protected as well as getPaint and/or getStrokingPaint and getNonStrokingPaint. 
All of these are currently private.

I had a think about different ways to achieve this use case, and I realised 
that it's already possible with PDFBox 2.0 to do this, all that is needed is to 
subclass Graphics2D, and call PDFRenderer.renderPageToGraphics. For example, to 
substitute the color green for the color red, all that is needed is the 
following override in a Graphics2D subclass:

{code}
@Override
public void setColor(Color color)
{
    if (color.getRGB() == Color.RED.getRGB())
    {
        graphics.setColor(Color.GREEN);    
    }
    else
    {
        graphics.setColor(color);
    }
}
{code}

So as it stands, there's no use case from this JIRA issue which can't already 
be achieved in 2.0 by using PDFGraphicsStreamEngine or by subclassing 
Graphics2D.

> 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