I am building a PDF file in my Java application and then I generate a graph using JFreeChart, saving it as JPEG. Now is there any way of embedding the generated image into the PDF? My current code for saving the chart looks like this:
int width = 1010;
int height = 1300;
File BarChart = new File( "BarChart.jpeg" );
try {
ChartUtils.saveChartAsJPEG( BarChart , chart , width , height );
} catch (IOException e) {
e.printStackTrace();
}
But I can not find a method of ChartUtils, which would embed the image into a PDF, nor could I not find any other way of doing this.
I was wondering if there was any dependency which could assist with importing the JFreeChart image into the given PDF.