<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" > <channel><title>Comments on: Generate Pie Chart/Bar Graph in PDF using iText &amp; JFreeChart</title> <atom:link href="http://viralpatel.net/blogs/2010/02/generate-pie-chart-bar-graph-in-pdf-using-itext-jfreechart.html/feed" rel="self" type="application/rss+xml" /><link>http://viralpatel.net/blogs/2010/02/generate-pie-chart-bar-graph-in-pdf-using-itext-jfreechart.html</link> <description>Tutorials, Java, J2EE, Struts, AJAX, JavaScript, CSS, Web 2.0, MySQL, Articles</description> <lastBuildDate>Thu, 09 Feb 2012 07:08:35 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: Lecusto</title><link>http://viralpatel.net/blogs/2010/02/generate-pie-chart-bar-graph-in-pdf-using-itext-jfreechart.html/comment-page-1#comment-24099</link> <dc:creator>Lecusto</dc:creator> <pubDate>Thu, 12 Jan 2012 10:41:46 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=2025#comment-24099</guid> <description>Thanks a lot for the tutorial. A small addition, you could replace the document line by the following to set the pdf size :Document document = new Document(new Rectangle(width,height));</description> <content:encoded><![CDATA[<p>Thanks a lot for the tutorial. A small addition, you could replace the document line by the following to set the pdf size :</p><p>Document document = new Document(new Rectangle(width,height));</p> ]]></content:encoded> </item> <item><title>By: Venkata</title><link>http://viralpatel.net/blogs/2010/02/generate-pie-chart-bar-graph-in-pdf-using-itext-jfreechart.html/comment-page-1#comment-12990</link> <dc:creator>Venkata</dc:creator> <pubDate>Thu, 12 Aug 2010 20:19:25 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=2025#comment-12990</guid> <description>Hi Viral,I am using iText and JFreeChart. I have generated a chart and am using iText to save the chart as PDF. When I save the PDF to filesystem, the file saves correctly, then when opened, shows chart without any problems.But when I try to serve the pdf as response to request, it gives me error file does not start with %pdf-.My code is below.Can you help me out in resolving this problem, where I might have made any mistake?Thanks.Regards, Venkata.Appreciate your help. &lt;code&gt; response.setContentType(&quot;application/pdf&quot;); Rectangle pagesize = new Rectangle(width, height); Document document = new Document(pagesize, 50, 50, 50, 50);try { PdfWriter writer = PdfWriter.getInstance(document, response.getOutputStream()); document.addTitle(&quot;Test PDF&quot;); document.addAuthor(&quot;research&quot;); document.addSubject(&quot;Demo&quot;); document.open();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); g2.dispose(); cb.addTemplate(tp, 0, 0);} catch (DocumentException de) { System.err.println(de.getMessage()); } document.close(); &lt;/code&gt;</description> <content:encoded><![CDATA[<p>Hi Viral,</p><p>I am using iText and JFreeChart.<br /> I have generated a chart and am using iText to save the chart as PDF.<br /> When I save the PDF to filesystem, the file saves correctly, then when opened, shows chart without any problems.</p><p>But when I try to serve the pdf as response to request, it gives me error file does not start with %pdf-.</p><p>My code is below.</p><p>Can you help me out in resolving this problem, where I might have made any mistake?</p><p>Thanks.</p><p>Regards,<br /> Venkata.</p><p>Appreciate your help.</p><p><code><br /> response.setContentType("application/pdf");<br /> Rectangle pagesize = new Rectangle(width, height);<br /> Document document = new Document(pagesize, 50, 50, 50, 50);</p><p> try {<br /> PdfWriter writer = PdfWriter.getInstance(document, response.getOutputStream());<br /> document.addTitle("Test PDF");<br /> document.addAuthor("research");<br /> document.addSubject("Demo");<br /> document.open();</p><p> PdfContentByte cb = writer.getDirectContent();<br /> PdfTemplate tp = cb.createTemplate(width, height);<br /> Graphics2D g2 = tp.createGraphics(width, height, mapper);<br /> Rectangle2D r2D = new Rectangle2D.Double(0, 0, width, height);<br /> chart.draw(g2, r2D);<br /> g2.dispose();<br /> cb.addTemplate(tp, 0, 0);</p><p> } catch (DocumentException de) {<br /> System.err.println(de.getMessage());<br /> }<br /> document.close();<br /> </code></p> ]]></content:encoded> </item> <item><title>By: Swapna</title><link>http://viralpatel.net/blogs/2010/02/generate-pie-chart-bar-graph-in-pdf-using-itext-jfreechart.html/comment-page-1#comment-12956</link> <dc:creator>Swapna</dc:creator> <pubDate>Fri, 06 Aug 2010 06:09:55 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=2025#comment-12956</guid> <description>I am sorry Viral. I didn&#039;t realize the site will format my text as per the html tags I mentioned. I will post the relevant part once again.The database text has tags like &quot;span&quot; with &quot;style&quot; set to &quot;font-weight:bold;&quot; or &quot;font-style:italic&quot; instead of using b, u or i like tags.</description> <content:encoded><![CDATA[<p>I am sorry Viral. I didn&#8217;t realize the site will format my text as per the html tags I mentioned. I will post the relevant part once again.</p><p>The database text has tags like &#8220;span&#8221; with &#8220;style&#8221; set to &#8220;font-weight:bold;&#8221; or &#8220;font-style:italic&#8221; instead of using b, u or i like tags.</p> ]]></content:encoded> </item> <item><title>By: Swapna</title><link>http://viralpatel.net/blogs/2010/02/generate-pie-chart-bar-graph-in-pdf-using-itext-jfreechart.html/comment-page-1#comment-12955</link> <dc:creator>Swapna</dc:creator> <pubDate>Fri, 06 Aug 2010 05:56:44 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=2025#comment-12955</guid> <description>Hi Viral,A very useful article! Thanks a bunch. :-)I am facing a technical problem and I wonder if you will be able to help me out. I am using iText 2.1.5 (I know a newer version exists) to generate pdf files. I am picking up text from database and putting it in the pdf file. The database text however has tags like &quot;Bold&quot; instead of good old &quot;&lt;code&gt;&lt;b&gt;Bold&lt;/b&gt;&lt;/code&gt;&quot;.Despite using HTMLWorker.parseToList, the text Bold&quot; is printed as it is in the generated pdf.  I see that  tags are not in the tagsSupported list of HTMLWorker.I have googled and checked many sites but nothing seems to be working so far. If I don&#039;t find any solution, I will have to resort to parsing the strings by myself and replacing  tags with appropriate html tags like &lt;code&gt;&lt;b&gt;&lt;/code&gt;, etc. I am hoping I don&#039;t have to do that as it somehow feels inelegant.Am I doing something wrong? Can you please help me out here? Thanks a lot once again! Swapna</description> <content:encoded><![CDATA[<p>Hi Viral,</p><p>A very useful article! Thanks a bunch. <img src='http://viralpatel.net/blogs/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /></p><p>I am facing a technical problem and I wonder if you will be able to help me out. I am using iText 2.1.5 (I know a newer version exists) to generate pdf files. I am picking up text from database and putting it in the pdf file. The database text however has tags like &#8220;Bold&#8221; instead of good old &#8220;<code>&lt;b&gt;Bold&lt;/b&gt;</code>&#8220;.</p><p>Despite using HTMLWorker.parseToList, the text Bold&#8221; is printed as it is in the generated pdf.  I see that  tags are not in the tagsSupported list of HTMLWorker.</p><p>I have googled and checked many sites but nothing seems to be working so far. If I don&#8217;t find any solution, I will have to resort to parsing the strings by myself and replacing  tags with appropriate html tags like <code>&lt;b&gt;</code>, etc. I am hoping I don&#8217;t have to do that as it somehow feels inelegant.</p><p>Am I doing something wrong? Can you please help me out here?<br /> Thanks a lot once again!<br /> Swapna</p> ]]></content:encoded> </item> <item><title>By: pravin Tarte</title><link>http://viralpatel.net/blogs/2010/02/generate-pie-chart-bar-graph-in-pdf-using-itext-jfreechart.html/comment-page-1#comment-12759</link> <dc:creator>pravin Tarte</dc:creator> <pubDate>Wed, 30 Jun 2010 07:06:06 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=2025#comment-12759</guid> <description>can u provide me a code to handle multiple edit button for each row of table .i am using dispatch action of struts 1 , but not been able to set the hidden varibale dynamically to send it to next action.</description> <content:encoded><![CDATA[<p>can u provide me a code to handle multiple edit button for each row of table .</p><p>i am using dispatch action of struts 1 , but not been able to set the hidden varibale dynamically to send it to next action.</p> ]]></content:encoded> </item> <item><title>By: suresh</title><link>http://viralpatel.net/blogs/2010/02/generate-pie-chart-bar-graph-in-pdf-using-itext-jfreechart.html/comment-page-1#comment-12216</link> <dc:creator>suresh</dc:creator> <pubDate>Mon, 01 Mar 2010 10:04:55 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=2025#comment-12216</guid> <description>Excellent Tutorial. It&#039;s Matches with my requirement. Very Very Thanks for Providing This tutorial</description> <content:encoded><![CDATA[<p>Excellent Tutorial. It&#8217;s Matches with my requirement. Very Very Thanks for Providing This tutorial</p> ]]></content:encoded> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced

Served from: viralpatel.net @ 2012-02-09 14:12:54 -->
