>Here I am facing the performance issue while using the 
>graphics instance of com.lowagie.text.pdf.PdfGraphics2D
>for drawing chart. 
>The fillArc() method overridden for PDFGraphics2D takes
>average 215 milliseconds to execute for my chart data.
>In against to this, while using sun.java2d.SunGraphics2D
>for drawing chart, the fillArc() method is executed 
>within 15 milliseconds for the same chart data.

Are you measuring the time to generate the entire PDF, or just the call to 
fillArc()?  Comparing "save a PDF to disk" to "draw an arc on screen" isn't a 
particularly fair comparison.  A better comparison would be to render that 
graphic to a highly compressed image format (extra work, like building a PDF), 
and writing it to the same sort of destination as your PDF (memory, disk, 
whatever).

I looked through the code called via fillArc, and there really isn't all that 
much there.  Worst case scenario generates 4 curve-to's, a pair of line-to's, 
and a fill command, the math to figure out which goes where, and maybe run 
those segments through an AffineTransform.  It's not generating a couple 
hundred straight lines to approximate a curve or anything silly like that.

If rendering this chart to PDF is the first time you use anything from iText, 
you also might be getting some overhead from the classLoader.

If anything, I'd expect the PdfGraphics2D.fillArc() call itself to be a bit 
faster than the one in SunGraphics2D.

--Mark Storer 
  Senior Software Engineer 
  Cardiff.com
#include <disclaimer> 
typedef std::Disclaimer<Cardiff> DisCard; 
-----Original Message-----
From: mihir brahmbhatt [mailto:[email protected]]
Sent: Thursday, December 17, 2009 2:37 AM
To: [email protected]
Subject: [iText-questions] URGENT:com.lowagie.text.pdf.PdfGraphics2D.fillArc() 
takes more timeto execute


 Hello,

        I am using iText for generating PDF output. I have a requirement where 
i need to draw a chart in PDF output. 
For drawing chart, I have the following code snippet.

            PdfTemplate tp = contentByte.createTemplate(chartWidth, 
chartHeight);
            //create graphics
            java.awt.Graphics2D g2d = tp.createGraphicsShapes(chartWidth, 
chartHeight);

Here, the method createGraphicsShapes() returns the graphics instance of 
com.lowagie.text.pdf.PdfGraphics2D. Now on the same instance, I am calling the 
method fillArc() to draw chart.

           Where in other case, for drawing chart I am directly using the 
graphics instance of sun.java2d.SunGraphics2D. And same as in case of PDF, on 
the graphics instance I am invoking method fillArc().

   
        This time difference is too vast, and inturn charts in PDF output takes 
lot of time to draw. So can anyone tell me the reason behind this? or its 
better if anyone can suggest me the alternative solution for this. 

        Any help will be appriciated. And Thanks in advance.

Thanks & Regards,
Mihir Brahmbhatt.





The INTERNET now has a personality. YOURS! See your Yahoo! Homepage.

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to