Create a chart using JFreeChart and Apache PDFBOX

I need to create charts using JFreeChart and then export them to PDF using Apache PDFBOX . I do not want to use iText, since it cannot be used in proprietary software.

I searched all over google but no luck! Has anyone done this?

+3
pdfbox jfreechart
source share
2 answers

Copy the OutputStream from the writeChartAs*() method of your writeChartAs*() in ChartUtilities to the InputStream used to create the PDXObjectImage in AddImageToPDF . A typical implementation of copyStream() shown here .

Addendum: Alternatively, use streams with streams to copy from output to input, as shown here here and here .

+4
source share

You can try using JasperReports . They are a little heavy, but they work well.

0
source share

All Articles