MainClass.java Source code

Java tutorial

Introduction

Here is the source code for MainClass.java

Source

import java.io.FileOutputStream;

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

public class MainClass {
    public static void main(String[] args) throws Exception {
        Document document = new Document();
        PdfWriter.getInstance(document, new FileOutputStream("2.pdf"));
        document.open();
        BaseFont bf = BaseFont.createFont("esl_gothic_unicode.ttf", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
        Font font = new Font(bf, 12);
        System.err.println(bf.getClass().getName());
        document.add(new Paragraph("this is a test.", font));
        document.add(new Paragraph("\ue70a\ue70a\ue70a\ue70a\ue70a\ue70a ", font));
        document.close();
    }
}