Using FontFactory to construct fonts : FontFactory « PDF RTF « Java






Using FontFactory to construct fonts

Using FontFactory to construct fonts
import java.io.FileOutputStream;

import com.lowagie.text.Document;
import com.lowagie.text.Font;
import com.lowagie.text.FontFactory;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.PdfWriter;

public class FontFactoryFontsPDF {

  public static void main(String[] args) {
    Document document = new Document();
    try {
      PdfWriter.getInstance(document, new FileOutputStream("FontFactoryFontsPDF.pdf"));
      document.open();
       
      document.add(new Paragraph("FontFactory.getFont(FontFactory.COURIER, Font.DEFAULTSIZE, Font.NORMAL)", FontFactory.getFont(FontFactory.COURIER, Font.DEFAULTSIZE, Font.NORMAL)));
      document.add(new Paragraph("FontFactory.getFont(FontFactory.COURIER, Font.DEFAULTSIZE, Font.ITALIC)", FontFactory.getFont(FontFactory.COURIER, Font.DEFAULTSIZE, Font.ITALIC)));
      document.add(new Paragraph("FontFactory.getFont(FontFactory.COURIER, Font.DEFAULTSIZE, Font.BOLD)", FontFactory.getFont(FontFactory.COURIER, Font.DEFAULTSIZE, Font.BOLD)));
      document.add(new Paragraph("FontFactory.getFont(FontFactory.COURIER, Font.DEFAULTSIZE, Font.BOLD | Font.ITALIC)", FontFactory.getFont(FontFactory.COURIER, Font.DEFAULTSIZE, Font.BOLD | Font.ITALIC)));
      document.add(new Paragraph("FontFactory.getFont(FontFactory.HELVETICA, Font.DEFAULTSIZE, Font.NORMAL)", FontFactory.getFont(FontFactory.HELVETICA, Font.DEFAULTSIZE, Font.NORMAL)));
      document.add(new Paragraph("FontFactory.getFont(FontFactory.HELVETICA, Font.DEFAULTSIZE, Font.ITALIC)", FontFactory.getFont(FontFactory.HELVETICA, Font.DEFAULTSIZE, Font.ITALIC)));
      document.add(new Paragraph("FontFactory.getFont(FontFactory.HELVETICA, Font.DEFAULTSIZE, Font.BOLD)", FontFactory.getFont(FontFactory.HELVETICA, Font.DEFAULTSIZE, Font.BOLD)));
      document.add(new Paragraph("FontFactory.getFont(FontFactory.HELVETICA, Font.DEFAULTSIZE, Font.BOLDITALIC)", FontFactory.getFont(FontFactory.HELVETICA, Font.DEFAULTSIZE, Font.BOLDITALIC)));
      document.add(new Paragraph("FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.NORMAL)", FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.NORMAL)));
      document.add(new Paragraph("FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.ITALIC)", FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.ITALIC)));
      document.add(new Paragraph("FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLD)", FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLD)));
      document.add(new Paragraph("FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLDITALIC)", FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLDITALIC)));
      document.add(new Paragraph("FontFactory.getFont(FontFactory.SYMBOL, Font.DEFAULTSIZE, Font.NORMAL)", FontFactory.getFont(FontFactory.SYMBOL, Font.DEFAULTSIZE, Font.NORMAL)));
      document.add(new Paragraph("FontFactory.getFont(FontFactory.ZAPFDINGBATS, Font.DEFAULTSIZE, Font.NORMAL)", FontFactory.getFont(FontFactory.ZAPFDINGBATS, Font.DEFAULTSIZE, Font.NORMAL)));
    } catch (Exception e) {
      System.err.println(e.getMessage());
    }
    document.close();
  }
}
           
       








itext.zip( 1,748 k)

Related examples in the same category

1.Using Font FactoryUsing Font Factory
2.Using Font Factory to Get all Registered Families
3.Font Factory Styles: BoldFont Factory Styles: Bold
4.Font Factory Styles ExampleFont Factory Styles Example
5.Using Registered FontUsing Registered Font