iText is a free and open source library for creating and manipulating
PDF documents in Java. The following example shows adding colored text to PDF document.
Document document = new Document(PageSize.A4);
PdfWriter.getInstance(document, new FileOutputStream("test3.pdf"));
//Open the document before adding any content
document.open();
Font myFonColor = FontFactory.getFont(FontFactory.TIMES_ROMAN, 24, BaseColor.ORANGE);
Paragraph paragraph = new Paragraph("BE THE CODER", myFonColor);
document.add(paragraph);