0

我试图将古吉拉特语的 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
    }
4

0 回答 0