Rasterize a PDF to Images

Once loaded from a file, converted from source content (webpages, URLs, HTML, etc...), or modified with margins, headers, footers, or other customizations, IronPDF can export pages of PDF documents into images that can be saved to a file system, stored in a database or sent over networks (among other uses).

The toBufferedImages method returns a List containing a collection of BufferedImage objects. Each BufferedImage contains the image byte content for a single page of the original PdfDocument. Moreover, the BufferedImage list is arranged in ascending order by page number. Developers can include a PageSelection object as an argument in the method call to generate this list for an inclusive set of pages in the PDF.

The featured code example creates a ToImageOptions object to set the expected width and height of the images post-conversion. This class also includes a method for changing the DPI of the image output (setDpi). The developer can pair together instances of this class along with that of the PageSelection to control the scope, size, and quality of PDF-to-Image conversion simultaneously.