Link

Converting an Image to a PDF file

Convert a Java BufferedImage into a PDF file

JDeli makes it very simple to convert a Java BufferedImage into a PDF file. This uses the JDeli class.

File myNewPdfFile = new File("file.pdf");
JDeli.write(myBufferedImage, "pdf", myNewPdfFile);

Convert an existing Image File into a PDF file in Java

JDeli will work out the input image file format automatically.

JDeli.convert(File inFile, File outFile);

JDeli.convert(InputStream inFile, OutputStream outfile, String format);

byte[] outputData = JDeli.convert(byte[] inputData, String format);

JDeli.convert(File inFile, EncoderOptions outputOptions, File outfile);

The last example allows you to specify different EncoderOptions depending on the format being written. These can let you set values such as image compression for image formats that support compression.