Html to pdf some characters are missing (itextsharp)

前端 未结 11 1752
不思量自难忘°
不思量自难忘° 2020-12-06 02:34

I want to export gridview to pdf by using the itextsharp library. The problem is that some turkish characters such as İ,ı,Ş,ş etc... are missing in the pdf document. The cod

11条回答
  •  不思量自难忘°
    2020-12-06 03:07

    I solved the problem. I can provide my the other solution type...

    try
    {
            BaseFont bf = BaseFont.CreateFont("c:\\windows\\fonts\\calibrib.ttf",
                BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
            Document document = new Document(PageSize.A4, 25, 25, 30, 30);
            PdfWriter writer = PdfWriter.GetInstance(document, fs);
    
            Font f = new Font(bf, 12f, Font.NORMAL);
            // Open the document to enable you to write to the document
            document.Open();
            // Add a simple and wellknown phrase to the document
            for (int x = 0; x != 100; x++)
            {
                document.Add(new Paragraph("Paragraph - This is a test! ÇçĞğİıÖöŞşÜü",f));
            }
    
            // Close the document
            document.Close();          
    }
    catch(Exception)
    {
    
    }
    

提交回复
热议问题