Register Fonts for PDF document : Font « PDF RTF « Java






Register Fonts for PDF document

import java.util.Iterator;

import com.lowagie.text.FontFactory;

public class RegisterFontPDF {
  public static void main(String[] args) {
    FontFactory.register("c:\\windows\\fonts\\comicbd.ttf");
    FontFactory.register("c:\\windows\\fonts\\comic.ttf");

    try {
      System.out.println("These fonts were registered at the FontFactory:");
      for (Iterator i = FontFactory.getRegisteredFonts().iterator(); i.hasNext();) {
        System.out.println(i.next());
      }
      System.out.println("These are the families these fonts belong to:");
      for (Iterator i = FontFactory.getRegisteredFamilies().iterator(); i.hasNext();) {
        System.out.println((String) i.next());
        
      }
    } catch (Exception e) {
      System.err.println(e.getMessage());
    }
  }
}
           
       








itext.zip( 1,748 k)

Related examples in the same category

1.Using BaseFontUsing BaseFont
2.Pdf standard fontsPdf standard fonts
3.Font Extra Style: NORMALFont Extra Style: NORMAL
4.Font Extra Style: STRIKETHRUFont Extra Style: STRIKETHRU
5.Font Extra Style: UNDERLINEFont Extra Style: UNDERLINE
6.Fixed Font WidthFixed Font Width
7.Font Color By PdfContentByteFont Color By PdfContentByte
8.Font Color in PDFFont Color in PDF
9.Font Encoding PDFFont Encoding PDF
10.Illustrate fontsIllustrate fonts
11.Font SelectionFont Selection
12.Font Style 1Font Style 1
13.Font Style 2Font Style 2
14.Font Style 3Font Style 3
15.Full Font Names
16.Listing Encodings for Pdf document