/ Published in: Java
Creates a new document with one page and draws a rectangle on it.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/** * @param args the command line arguments * @throws java.io.IOException */ PDDocument document = new PDDocument(); PDPage page = new PDPage(PDRectangle.A4); document.addPage(page); PDPageContentStream contentStream = new PDPageContentStream(document, page); contentStream.addRect(100, 100, 100, 100); contentStream.fill(); contentStream.close(); document.save(""); document.close(); }