I'm learning about Java and iText API to generate PDF reports. What I want is very simple: add a Paragraph
to my PDF file (Report.pdf
). It works perfectly in my code:
doc = new Document(PageSize.A4.rotate());
PdfWriter.getInstance(doc, new FileOutputStream("Report.pdf"));
doc.open();
doc.add(new Paragraph("One!"));
Now I want to add my Paragraph
in the end of file if Report.pdf
exists. I've tried to use true
in FileOutputStream as a 2nd parameter but it didn't work. I suspect is because of my line one generates an empty document, but I'm not sure. Does anyone knows how to solve it?