PDFBox does not write the message I want into the page
up vote
3
down vote
favorite
1
I'm looking for at least an hour at my code but I can't find the bug. I'm using PDFBox to create PDF's (PDFBox HelloWorld Example). To learn how PDFBox works I just wanted to create some pages with "hello world" and the page number like "hello world 1", "hello world 2" and so on. As you can see I created a for loop to create six pages. private void drawPDF(PDDocument doc, File file) throws IOException { for (int pageIndex = 0; pageIndex < 6; pageIndex++) { PDPage page = new PDPage(PDRectangle.A4); doc.addPage(page); PDFont font = PDType1Font.HELVETICA_BOLD; String message = "hello world " + (pageIndex + 1); float stringHeight = font.getFontDescriptor().getFontBoundingBox().getHeight() * FONT_S...