This Java program converts a PDF file to multiple JPEG files using Qoppa’s library Java PDF image library jPDFImages. This program loops through the pages contained in a PDF document and outputs a JPEG image for each PDF page. In this program, the resolution is set to 150 dpi and the JPEG quality to 0.8. Both these parameters are customizable.

// open PDF document
PDFImages pdfDoc = new PDFImages ("input.pdf", null);
// loop through all pages
for (int count = 0; count < pdfDoc.getPageCount(); ++count)
{
   // save PDF page to a JPEG image at 150 DPI resolution and 0.8 JPEG quality 
   pdfDoc.savePageAsJPEG(count, "output_" + count + ".jpg", 150, 0.8f);
}

Download Full Java Sample