public static void main(String[] args) {
System.out.println("Standard Type 1 fonts: FontFactory");
// step 1: creation of a document-object
LwgDocument document = new LwgDocument();
try {
// step 2:
// we create a writer that listens to the document
PdfWriter.getInstance(document,
new GfrFileOutputStream("com.lowagie.examples.fonts.FontFactoryType1Fonts.pdf"));
// step 3: we open the document
document.open();
// step 4:
// the 14 standard fonts in PDF
LwgFont[] fonts = new LwgFont[14];
fonts[0] = FontFactory.getFont(FontFactory.COURIER, LwgFont.DEFAULTSIZE, LwgFont.NORMAL);
fonts[1] = FontFactory.getFont(FontFactory.COURIER, LwgFont.DEFAULTSIZE, LwgFont.ITALIC);
fonts[2] = FontFactory.getFont(FontFactory.COURIER, LwgFont.DEFAULTSIZE, LwgFont.BOLD);
fonts[3] = FontFactory.getFont(FontFactory.COURIER, LwgFont.DEFAULTSIZE, LwgFont.BOLD | LwgFont.ITALIC);
fonts[4] = FontFactory.getFont(FontFactory.HELVETICA, LwgFont.DEFAULTSIZE, LwgFont.NORMAL);
fonts[5] = FontFactory.getFont(FontFactory.HELVETICA, LwgFont.DEFAULTSIZE, LwgFont.ITALIC);
fonts[6] = FontFactory.getFont(FontFactory.HELVETICA, LwgFont.DEFAULTSIZE, LwgFont.BOLD);
fonts[7] = FontFactory.getFont(FontFactory.HELVETICA, LwgFont.DEFAULTSIZE, LwgFont.BOLDITALIC);
fonts[8] = FontFactory.getFont(FontFactory.TIMES_ROMAN, LwgFont.DEFAULTSIZE, LwgFont.NORMAL);
fonts[9] = FontFactory.getFont(FontFactory.TIMES_ROMAN, LwgFont.DEFAULTSIZE, LwgFont.ITALIC);
fonts[10] = FontFactory.getFont(FontFactory.TIMES_ROMAN, LwgFont.DEFAULTSIZE, LwgFont.BOLD);
fonts[11] = FontFactory.getFont(FontFactory.TIMES_ROMAN, LwgFont.DEFAULTSIZE, LwgFont.BOLDITALIC);
fonts[12] = FontFactory.getFont(FontFactory.SYMBOL, LwgFont.DEFAULTSIZE, LwgFont.NORMAL);
fonts[13] = FontFactory.getFont(FontFactory.ZAPFDINGBATS, LwgFont.DEFAULTSIZE, LwgFont.NORMAL);
// add the content
for (int i = 0; i < 14; i++) {
document.add(new Paragraph("quick brown fox jumps over the lazy dog", fonts[i]));
}
} catch (DocumentException de) {
System.err.println(de.getMessage());
} catch (IOException ioe) {
System.err.println(ioe.getMessage());
}
// step 5: we close the document
document.close();
}