PDF to BMP - pqScan.com
Java PDF to BMP Converting PDF Pages into BMP Image Files in Java Download Trial Purchase Now

How to Convert PDF to BMP in Java?

back to home  >  PDF to Image in Java  >  How to Convert PDF to Image in Java  >  Convert PDF to BMP

Getting BMP image from PDF pages is a key feature in pqScan Java PDF to Image SDK. Java PDF to Image converter library is completely developed in Java SDK 1.6, and customers can easily integrate the transforming PDF pages to bmp function in their Java application.

Install Java PDF to Image Converter to your Java application

  • Copy pqScan.PDFtoImage.jar to your Java project library folder.
  • Add pqScan.PDFtoImage.jar to your Java classpath.

Java PDF to BMP APIs

Support properties:

//before converting PDF to bmp, you can get all the PDF page count to decide which one to convert 
public int getPageCount();
//changing output bmp image quality and definition by setting image resolution
public void setDPI(int dpi);

Support methods:

//load PDF document from the local file
public void loadPDF(String fileName);
//open PDF document from PDF stream
public void loadPDF(InputStream stream);
//get bmp image from current PDF page
public BufferedImage toImage(int pageIndex);
//get bmp image from current PDF page, you can set the output image size
public BufferedImage toImage(int pageIndex, int width, int height);

Turning PDF Pages to BMP in Java class

As we provide flexible properties and methods, you can easy to use these to open a PDF document and convert it to bmp image format. Here the Java sample codes are listed to introduce you how to transform PDF to bmp images. And we also provide article for getting customized size of images from PDF pages in Java.

import com.pqscan.pdftoimage.PDFDocument;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;

public class PDFtoBMPConverter {

   public static void main(String[] args)
   {
       try
       {
           //initialize PDFDocument object
           PDFDocument doc = new PDFDocument();
           //load PDF document
           doc.loadPDF("Sample.pdf");
           //get total PDF page count
           int pageCount = doc.getPageCount();

           for(int i = 0; i < pageCount; i++)
           {
               //convert each PDF page to image
               BufferedImage image = doc.toImage(i);
               //save image as bmp image file
               ImageIO.write(image,"bmp", new File("output"+ i +".bmp"));
           }

       }
       catch (Exception e) {
               e.printStackTrace();
       }
   }
}

convert pdf page to bitmap image in java

PDF to Image Convert to JPEG in Java Convert to PNG in Java Convert to GIF in Java Convert to TIFF in Java Convert to Multi-TIFF in Java