// step 4: we grab the ContentByte and do some stuff with it
// we create a fontMapper and read all the fonts in the font directory
DefaultFontMapper mapper = new DefaultFontMapper();
FontFactory.registerDirectories();
mapper.insertDirectory("c:\\windows\\fonts");
// we create a template and a Graphics2D object that corresponds with it
int w = 150;
int h = 150;
PdfContentByte cb = writer.getDirectContent();
PdfTemplate tp = cb.createTemplate(w, h);