Unicode使用iTextSharp将问题渲染为PDF

时间:2013-09-27 13:52:45

标签: pdf unicode itextsharp

我试图将古吉拉特语HTML文本呈现为PDF,这些文本会呈现但不正确。我试图将“કાર્બનકેમેસ્ટ્રી”文本呈现为PDF,但它会像“કારબનકેમસટર​​ી”一样呈现

请你帮忙正确地渲染它。

  protected void btnPDF_Click(object sender, EventArgs e)
    {
        Document doc = new Document(iTextSharp.text.PageSize.LETTER, 10, 10, 42, 35);

        BaseFont Gujarati = iTextSharp.text.pdf.BaseFont.CreateFont("C:\\WINDOWS\\Fonts\\ARIALUNI.TTF", BaseFont.IDENTITY_H, BaseFont.EMBEDDED); // --> CHANGED

        iTextSharp.text.Font fontNormal = new iTextSharp.text.Font(Gujarati);

        PdfWriter wri = PdfWriter.GetInstance(doc, new FileStream("c:\\Test11.pdf", FileMode.Create));
        //Open Document to write
        doc.Open();

        //Write some content
        Paragraph paragraph = new Paragraph("કાર્બન કેમેસ્ટ્રી", fontNormal); // --->> CHANGED Specify the font to use

        // Now add the above created text using different class object to our pdf document
        doc.Add(paragraph);

        doc.Close(); //Close document
    }

0 个答案:

没有答案
相关问题