Generate chart with JFreeChart and Apache PDFBOX

前端 未结 2 1488
旧时难觅i
旧时难觅i 2021-02-04 22:14

I need to generate charts using JFreeChart and then export them to PDF using Apache PDFBOX. I don\'t want to use iText as it cannot be used in proprietary software.

I se

2条回答
  •  生来不讨喜
    2021-02-04 22:37

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

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

提交回复
热议问题