Java Code Examples for org.apache.pdfbox.pdmodel.PDPage.convertToImage()

The following are Jave code examples for showing how to use convertToImage() of the org.apache.pdfbox.pdmodel.PDPage class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: pdfbox-layout   File: CompatibilityHelper.java   Source Code and License Vote up 5 votes
/**
    * Renders the given page as an RGB image.
    * 
    * @param document
    *            the document containing the page.
    * @param pageIndex
    *            the index of the page to render.
    * @param resolution
    *            the image resolution.
    * @return the rendered image
    * @throws IOException
    *             by pdfbox
    */
   public static BufferedImage createImageFromPage(final PDDocument document,
    final int pageIndex, final int resolution) throws IOException {
final PDPage page = (PDPage) document.getDocumentCatalog()
	.getAllPages().get(pageIndex);
return page.convertToImage(BufferedImage.TYPE_INT_RGB, resolution);
   }