itext Pdf Creation: iText 5 versus iText 7 HelloWorld.java (iText 5)


Example

Suppose that we want to create a simple Hello World document:

enter image description here

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