UsingUnicodePDF.java Source code

Java tutorial

Introduction

Here is the source code for UsingUnicodePDF.java

Source

import java.io.FileOutputStream;

import com.lowagie.text.Document;
import com.lowagie.text.Element;
import com.lowagie.text.Font;
import com.lowagie.text.Phrase;
import com.lowagie.text.pdf.BaseFont;
import com.lowagie.text.pdf.ColumnText;
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.pdf.PdfWriter;

public class UsingUnicodePDF {
    public static void main(String[] args) {
        Document document = new Document();
        try {
            PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("UsingUnicodePDF.pdf"));
            document.open();

            document.add(new Phrase("\u0161"));
            document.add(new Phrase("\u0178"));
            document.add(new Phrase("\u017D"));
            document.add(new Phrase("\u017E"));

        } catch (Exception e) {
            System.err.println(e.getMessage());
        }
        document.close();
    }
}