I'm using the following method to create a PDF file:
private void createPdf() throws IOException {
PDDocument doc = new PDDocument();
PDPage page = new PDPage();
doc.addPage(new PDPage());
PDPageContentStream content = new PDPageContentStream(doc, page);
content.beginText();
content.setFont(PDType1Font.HELVETICA, 26);
content.showText("Example Text");
content.endText();
content.close();
doc.save("report.pdf");
doc.close();
}
It creates a new file with a white page, but no text is shown. What's wrong?
I use Apache PDFBox 2.0.7.