MainClass.java Source code

Java tutorial

Introduction

Here is the source code for MainClass.java

Source

import java.io.FileOutputStream;

import com.lowagie.text.Chunk;
import com.lowagie.text.Document;
import com.lowagie.text.Phrase;
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();

        String text = (char) 945 + " " + (char) 946 + " " + (char) 947;
        document.add(Phrase.getInstance(text));
        document.add(Chunk.NEWLINE);
        for (int i = 913; i < 970; i++) {
            document.add(Phrase.getInstance(String.valueOf(i) + ": " + (char) i + " "));
        }
        document.close();
    }

}