How to use and not use iText and jFreeChart

Introduction

In this blog, I will talk about, iText, a Java API used in creating/manipulating PDFs and, jFreeChart, a Java API used in creating charts/graphs. I will make some suggestions based on my experience with iText and jFreeChart on how to use AND not use these APIs for generating PDFs with charts/graphs. I really wanted to write about topic because I found a lot of examples showing how to use iText and jFreeChart that resulted in unacceptable quality for professional use or display. On the other hand, I did see one example that showed how to generate high quality charts/graphs using iText and jFreeChart, however, I considered it incomplete as I was left wonder about “what-ifs.”

Before we proceed, you will need iText v5.0.1 and jFreeChart v1.0.13 to get the examples following to compile and execute. You may download iText at http://itextpdf.com/ and jFreeChart at http://www.jfree.org/.
Continue reading

How to create an in-memory PDF report and send as an email attachment using iText and Java

In this blog entry, I will show with a few lines of code how to create an in-memory PDF report and send it as an email attachment. Why is this exercise or illustration important? It is important to me because I’m involved in a lot of report generation projects where the reporting logic and display center around PDFs, and due to server constraints (i.e. space), it is not desirable to store these PDF reports as files; the goal is to generate PDF reports on the fly and send them off to the client. Furthermore, I found a lot of search results from the major search engines that discussed the same issue, but no clear example was given in Java. Two such discussions are below.

On the other hand, a full example in C# was also discovered here http://stackoverflow.com/questions/1196059/itextsharp-sending-in-memory-pdf-in-an-email-attachment.
Continue reading