Hi,
We have an issue with rendering text in PDF when using the specific sequence of 
Graphics2D methods. First, we are calling fillRect() using transparent white 
color, then createGraphics(), setClip() and draw the text within rectangle.  
The text is not visible in PDF.

private static void drawGraphics(Graphics graphics){
    Graphics2D g = (Graphics2D)graphics;

   // this text will be visible on screen and in PDF
    g.setColor(Color.BLUE);
    g.drawString("Visible on screen and in PDF", 0, HALF_HEIGHT);

    // fill rectangle with transparent white color
    g.setColor(new Color(255, 255, 255, 0));
    g.fillRect(0, 0, WIDTH, HALF_HEIGHT);

    // the create() and setClip() is important
    Graphics2D g2 = (Graphics2D)graphics.create();
    g2.setClip(0, 0, WIDTH, HALF_HEIGHT);

    // Here is the problem, this text not appear in PDF
    g2.setColor(Color.BLUE);
    g2.drawString("Visible on screen only", 0, 40);
}
  private static final int WIDTH = 200;
 private static final int HEIGHT = 250;
 private static final int HALF_HEIGHT = HEIGHT / 2;

The sample code that demonstrates this issue is attached.  We are using iText 
5.1.1 on Windows, JDK1.6.16.

Will it make sense to just ignore the calls to fill(Shape) and fillRect() when 
color is fully transparent?
Any thoughts?

Regards,
Andrey




________________________________
The information contained in this email may contain confidential or legally 
privileged information. If you are not the intended recipient any disclosure, 
copying, distribution or taking any action on the contents of this information 
may be unlawful. If you have received this email in error, please delete it 
from your system and notify us immediately. Any views expressed in this message 
are those of the individual sender, except where the message states otherwise. 
IDBS takes no responsibility for any computer virus which might be transferred 
by way of this email and recommends that you subject any incoming E-mail to 
your own virus checking procedures. We may monitor all E-mail communication 
through our networks. If you contact us by E-mail, we may store your name and 
address to facilitate communication.

Attachment: TransparencyItextPdf.java
Description: TransparencyItextPdf.java

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to