Java tutorial
import java.io.FileOutputStream; import java.io.IOException; import java.util.Iterator; import java.util.TreeSet; import com.lowagie.text.Document; import com.lowagie.text.DocumentException; import com.lowagie.text.FontFactory; import com.lowagie.text.Paragraph; import com.lowagie.text.pdf.BaseFont; import com.lowagie.text.pdf.PdfWriter; public class UsingFontFactoryPDF { public static void main(String[] args) { Document document = new Document(); try { PdfWriter.getInstance(document, new FileOutputStream("UsingFontFactoryPDF.pdf")); document.open(); Paragraph p = new Paragraph("Font Families", FontFactory.getFont(FontFactory.HELVETICA, 16f)); document.add(p); FontFactory.registerDirectories(); TreeSet families = new TreeSet(FontFactory.getRegisteredFamilies()); for (Iterator i = families.iterator(); i.hasNext();) { p = new Paragraph((String) i.next()); document.add(p); } } catch (Exception e) { System.err.println(e.getMessage()); } document.close(); } }