Suppose that we want to create a simple Hello World document:
In iText 5, this would be done like this:
public void createPdf(String dest)
throws DocumentException, IOException {
Document document = new Document();
PdfWriter.getInstance(
document, new FileOutputStream(dest));
document.open();
document.add(new Paragraph("Hello World!"));
document.close();
}
Source: developers.itextpdf.com