I am trying to include charts in iText generated by JFreeChart.
These charts include transparent colors (java.awt.Color with alpha-transparency).
Anyway, these transparent colors are opaque when they are in the PDF document. Anyone has a suggestion. Above the code I use to include the graphic in iText.




    public void generateIntoPDFWriter(PdfWriter writer, int width,
                                        int height) {
        JFreeChart chart = this.preProcess();
        Rectangle pagesize = new Rectangle(width, height);
        FontMapper mapper = new DefaultFontMapper();

        PdfContentByte cb = writer.getDirectContent();
        PdfTemplate tp = cb.createTemplate(width, height);
        Graphics2D g2 = tp.createGraphics(width, height, mapper);
        Rectangle2D r2D = new Rectangle2D.Double(0, 0, width, height);
        chart.draw(g2, r2D, null);
        g2.dispose();
        cb.addTemplate(tp, 0, 0);
    }


public static void main(String args[]) { OutputStream os = new FileOutputStream("/work/phred/test.pdf"); Document doc = new Document(com.lowagie.text.PageSize.A4); PdfWriter docWriter = null; docWriter = PdfWriter.getInstance(doc, os); doc.open(); generateIntoPDFWriter(docWriter, width, height); doc.close(); os.close(); }



-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the
same time. Free trial click here: http://www.vmware.com/wl/offer/345/0
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to