So I want to not only add text to a pdf when I create it but as well add a background image at the same time. I was wondering if this is possible since I haven't been able to find any example and the only question similar to this (This one) has not given any feedback from the person that made the question and it wasn't marked as solved.
I'm using this very simple example at the moment:
PDDocument doc = null;
PDPage page = null;
try{
doc = new PDDocument();
page = new PDPage();
doc.addPage(page);
PDFont font = PDType1Font.HELVETICA_BOLD;
PDPageContentStream content = new PDPageContentStream(doc, page);
content.beginText();
content.setFont( font, 12 );
content.moveTextPositionByAmount( 100, 700 );
content.drawString("Hello World");
content.endText();
content.close();
doc.save("printme.pdf");
doc.close();
} catch (Exception e){
System.out.println(e);
}
Thanks for your time.