Return to Snippet

Revision: 72661
at October 12, 2017 21:29 by markt22


Initial Code
/**
 * @param args the command line arguments
 * @throws java.io.IOException
 */
public static void main(String[] args) throws IOException {
    PDDocument document = new PDDocument();
    PDPage page = new PDPage(PDRectangle.A4);
    
    document.addPage(page);
    
    PDPageContentStream contentStream = new PDPageContentStream(document, page);
    
    PDImageXObject pdImage = PDImageXObject.createFromFile("", document);
    contentStream.drawImage(pdImage, 0, 0);
    
    contentStream.close();
    
    document.save("");
    document.close();
}

Initial URL

                                

Initial Description
Creates a new document with a single page and adds an image to it

Initial Title
PDFBox: Add image to page

Initial Tags

                                

Initial Language
Java