Skip to main content
Skip table of contents

pdfCalligraph: Support for Myanmar script

With iText 7.1.13 and pdfCalligraph 2.0.8, we are pleased to announce that we now support the full support for rendering Myanmar script.

This functionality will allow users to easily render Myanmar script within their PDFs. Below is an quick example showing how to achieve this.

The following variables represents file paths as strings to their designated file:

  •   licensePath - String value to the path of iText license key.
  •   outputPath - String value of the path where the output pdf file will be generated
  •   pathToFontFile - String value to the path of the Myanmar font file.

JAVA

JAVA
package Myanmar;

import com.itextpdf.io.font.PdfEncodings;
import com.itextpdf.kernel.font.PdfFont;
import com.itextpdf.kernel.font.PdfFontFactory;
import com.itextpdf.kernel.pdf.PdfDocument;
import com.itextpdf.kernel.pdf.PdfWriter;
import com.itextpdf.layout.Document;
import com.itextpdf.layout.element.Paragraph;
import com.itextpdf.licensekey.LicenseKey;

import java.io.IOException;

public class Myanmar {

    static String licensePath ="license.xml";
    static String outputPath ="outputPdf.pdf";
    static String pathToFontFile = "fontFile.ttf";
    
    public static void main(String[] args) throws IOException {
        LicenseKey.loadLicenseFile(licensePath);
        PdfDocument pdfDocument = new PdfDocument(new PdfWriter(outputPath));
        Document document = new Document(pdfDocument);
        PdfFont font = PdfFontFactory.createFont(pathToFontFile, PdfEncodings.IDENTITY_H);
        document.setFont(font);
        String text =" ြန်မာနိုင်ငံ 􀀀တရားဝင်အားဖြ င့် ပြ ည်ထော င်စု သမ္မတ မြ န်မာနိုင်ငံတော် 􀀀သည် အရှေ့ တော င်အာရှတွင် ဧရိယာ";
        document.add(new Paragraph(text));
        document.close();
    }
}

C#

C#
using iText.IO.Font;
using iText.Kernel.Font;
using iText.Kernel.Pdf;
using iText.Layout;
using iText.Layout.Element;
using iText.License;
using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApp1.iText
{
    class Myanmar
    {
        static String licensePath = "license.xml";
        static String outputPath = "outputPdf.pdf";
        static String pathToFontFile = "fontFile.ttf";

        public static void Main(String[] args)
        {
            LicenseKey.LoadLicenseFile(licensePath);
            PdfDocument pdfDocument = new PdfDocument(new PdfWriter(outputPath));
            Document document = new Document(pdfDocument);
            PdfFont font = PdfFontFactory.CreateFont(pathToFontFile, PdfEncodings.IDENTITY_H);
            document.SetFont(font);
            String text = " ြန်မာနိုင်ငံ 􀀀တရားဝင်အားဖြ င့် ပြ ည်ထော င်စု သမ္မတ မြ န်မာနိုင်ငံတော် 􀀀သည် အရှေ့ တော င်အာရှတွင် ဧရိယာ";
            document.Add(new Paragraph(text));
            document.Close();
        }
    }
}


Example output PDF:

  







JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.