Illustrate fonts : Font « PDF RTF « Java






Illustrate fonts

Illustrate fonts
import java.io.FileOutputStream;

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

public class FontListPDF {
  public static void main(String[] args) {
    try {
      Document document = new Document();
      PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("FontListPDF.pdf"));
      document.open();
      Paragraph p = new Paragraph();
      p.add(new Chunk("Font.TIMES_ROMAN", new Font(Font.TIMES_ROMAN, 12)));
      p.add(Chunk.NEWLINE);
      p.add(new Chunk("Font.ZAPFDINGBATS", new Font(Font.ZAPFDINGBATS, 12)));
      p.add(Chunk.NEWLINE);
      p.add(new Chunk("Font.SYMBOL", new Font(Font.SYMBOL, 12)));
      p.add(Chunk.NEWLINE);
      p.add(new Chunk("Font.BOLD|Font.SYMBOL", new Font(Font.BOLD|Font.SYMBOL, 12)));
      p.add(Chunk.NEWLINE);
      p.add(new Chunk("Font.STRIKETHRU", new Font(Font.STRIKETHRU, 12)));
      p.add(Chunk.NEWLINE);
      p.add(new Chunk("Font.STRIKETHRU|Font.BOLDITALIC", new Font(Font.STRIKETHRU|Font.BOLDITALIC, 12)));
      p.add(Chunk.NEWLINE);
      p.add(new Chunk("Font.HELVETICA", new Font(Font.HELVETICA, 12)));
      p.add(Chunk.NEWLINE);
      p.add(new Chunk("Font.HELVETICA", new Font(Font.HELVETICA, Font.DEFAULTSIZE)));
      p.add(Chunk.NEWLINE);
      p.add(new Chunk("Font.UNDERLINE", new Font(Font.UNDERLINE, Font.DEFAULTSIZE)));
      p.add(Chunk.NEWLINE);
      p.add(new Chunk("Font.COURIER ", new Font(Font.COURIER, Font.DEFAULTSIZE)));
      document.add(new Paragraph(p));

      document.close();
    } catch (Exception de) {
      de.printStackTrace();
    }
  }
}

           
       








itext.zip( 1,748 k)

Related examples in the same category

1.Using BaseFontUsing BaseFont
2.Pdf standard fontsPdf standard fonts
3.Register Fonts for PDF document
4.Font Extra Style: NORMALFont Extra Style: NORMAL
5.Font Extra Style: STRIKETHRUFont Extra Style: STRIKETHRU
6.Font Extra Style: UNDERLINEFont Extra Style: UNDERLINE
7.Fixed Font WidthFixed Font Width
8.Font Color By PdfContentByteFont Color By PdfContentByte
9.Font Color in PDFFont Color in PDF
10.Font Encoding PDFFont Encoding PDF
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