FontListPDF.java Source code

Java tutorial

Introduction

Here is the source code for FontListPDF.java

Source

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();
        }
    }
}