You can achieve this using Gnostice PDFOne for Java ( http://www.gnostice.com/PDFOne_Java.asp ).
Locate the code snippet below that creates the PDF from the PNG image.
PdfDocument doc = new PdfDocument();
To create a BufferedImage from JPanel, you can use the code snippet below.
int w = jpanel.getWidth(); int h = jpanel.getHeight(); BufferedImage bi = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB); Graphics2D g2 = bi.createGraphics(); jpanel.paint(g2); g2.dispose();
After creating the BuffereImage from JPanel, you can use the first code snippet to create the PDF.
Hope you find this helpful.
Disclaimer: I work for Gnostis.
source share