Return to Snippet

Revision: 72621
at September 27, 2017 17:44 by markt22


Updated Code
/**
 * @param args the command line arguments
 * @throws java.io.IOException
 */
public static void main(String[] args) throws IOException {
    File file = new File("");

    PDDocument doc = PDDocument.load(file);
    PDFRenderer pdfRenderer = new PDFRenderer(doc);
    BufferedImage image = pdfRenderer.renderImageWithDPI(0, 300);

    ImageIOUtil.writeImage(image,"", 300);
    doc.close();
}

Revision: 72620
at September 27, 2017 17:40 by markt22


Initial Code
/**
 * @param args the command line arguments
 * @throws java.io.IOException
 */
public static void main(String[] args) throws IOException {
    File file = new File("");

    PDDocument doc = PDDocument.load(file);
    PDFRenderer pdfRenderer = new PDFRenderer(doc);
    BufferedImage image = pdfRenderer.renderImageWithDPI(0, 300);

    ImageIOUtil.writeImage(image,"", 300);
}

Initial URL

                                

Initial Description
Opens a PDF Document and renders the first page as an image, which is then saved to file.

Initial Title
PDFBox: Render first page in a document

Initial Tags

                                

Initial Language
Java