Results 1 to 2 of 2

Thread: Issue with arabic language using itextsharp vb.net

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2019
    Posts
    13

    Issue with arabic language using itextsharp vb.net

    I am using iTextSharp to convert HTML to pdf that has arabic and english characters,. I was able to show the English characters, but no luck with the arabic ones. I am using below code

    Code:
            Dim bf As BaseFont = BaseFont.CreateFont("c:\windows\fonts\arial.ttf", BaseFont.IDENTITY_H, True)
            Using sw As StringWriter = New StringWriter()
                Using hw As HtmlTextWriter = New HtmlTextWriter(sw)
                    Me.Page.RenderControl(hw)
                    Dim sr As StringReader = New StringReader(sw.ToString())
                    Dim pdfDoc As Document = New Document(PageSize.A4, 10.0F, 10.0F, 10.0F, 0.0F)
                    Dim writer As PdfWriter = PdfWriter.GetInstance(pdfDoc, Response.OutputStream)
                    pdfDoc.Open()
                    Dim font As New iTextSharp.text.Font(bf, 10, iTextSharp.text.Font.NORMAL)
                    XMLWorkerHelper.GetInstance().ParseXHtml(writer, pdfDoc, sr)
                    pdfDoc.Close()
                    Response.Cache.SetCacheability(HttpCacheability.NoCache)
                    Response.Write(pdfDoc)
                    Response.End()
                End Using
            End Using

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,413

    Re: Issue with arabic language using itextsharp vb.net

    Seems you need Arial Unicode, instead of basic Arial?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width