Unicode Example : Unicode « PDF RTF « Java






Unicode Example

Unicode Example
import java.io.FileOutputStream;
import java.io.IOException;

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

public class UnicodeExamplePDF {
  public static void main(String[] args) {
    Document document = new Document();

    try {
      PdfWriter.getInstance(document, new FileOutputStream("UnicodeExamplePDF.pdf"));
      document.open();

      BaseFont bfComic = BaseFont.createFont("c:\\windows\\fonts\\arial.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
      document.add(new Paragraph("Unicode: \u0418", new Font(bfComic, 12)));
    } catch (Exception e) {
      System.err.println(e.getMessage());
    }
    document.close();
  }
}

           
       








itext.zip( 1,748 k)

Related examples in the same category

1.Using UnicodeUsing Unicode
2.Adding Special Symbol to Pdf documentAdding Special Symbol to Pdf document
3.Arabic Text in PDFArabic Text in PDF