iText is a free and open source library for creating and manipulating
PDF documents in Java. The following example shows using default page margins in PDF document.
Document document = new Document(PageSize.A4);
//Default margins are 36, 36, 36, 36
//Above declaration is just same as
//new Document(PageSize.A4, 36, 36, 36, 36);
PdfWriter.getInstance(document, new FileOutputStream("test26.pdf"));
//Open the document before adding any content
document.open();
Paragraph paragraph = new Paragraph("BE THE CODER");
document.add(paragraph);