String message = "This is a message in the page.";
PDDocument document = new PDDocument();
PDPage page = new PDPage();
PDPageContentStream contentStream = new PDPageContentStream( document, page, AppendMode.APPEND, true, true);
contentStream.beginText();
contentStream.setFont( font, fontSize ); // set font and font size.
contentStream.setNonStrokingColor( 1f, 0, 0 ); // set text color to red
// Modify font to appear in Italic:
Matrix matrix = new Matrix( 1, 0, .2f, 1, 7, 5 );
contentStream.setTextMatrix( matrix );
// Modify the font to appear in bold:
contentStream.setRenderingMode( RenderingMode.FILL_STROKE );
contentStream.setStrokingColor( 1f, 0, 0 );
// Write text:
contentStream.showText( message );