我创建了一个简单的代码,该代码创建了一个包含文本的pdf文件,并且仅当使用英文文本时才可以正常工作,但问题是当我使用阿拉伯语文本时像这样被分开了:السللاممللي م
但是字母应该像这样连接:السلامعليكم
这是我的带有阿拉伯文本的代码,我们将不胜感激。
Imports iTextSharp.text.pdf
Imports iTextSharp.text
Imports System.IO
Imports System.Drawing.Imaging
Imports iTextSharp.text.pdf.PdfPCell
Imports iTextSharp.text.pdf.PdfPTable
Imports iTextSharp.text.pdf.BaseFont
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim fontLoc = "C:\Users\Win 10\Documents\Visual Studio 2012\Projects\WindowsFormsApplication1\WindowsFormsApplication1\ScheherazadeRegOT.ttf"
Dim basef As BaseFont = BaseFont.CreateFont(fontLoc, BaseFont.IDENTITY_H, True)
Dim arabicfont As New iTextSharp.text.Font(basef, 24, iTextSharp.text.Font.NORMAL, iTextSharp.text.BaseColor.BLACK)
Dim el As New Chunk()
Dim arabicfont2 As New iTextSharp.text.Font(basef, 16, el.Font.Style, el.Font.Color)
el.Font = arabicfont2
Dim pdfPTable As New PdfPTable(1)
Dim pdfDoc As New Document()
Dim pdfWrite As PdfWriter = PdfWriter.GetInstance(pdfDoc, New FileStream("C:\Users\Win 10\Desktop\mjh.pdf", FileMode.Create))
pdfDoc.Open()
pdfDoc.Add(New Paragraph(StrReverse("السلام عليكم"), el.Font))
'Launch the document if you have a file association set for PDF's
Dim AcrobatReader As Process = New Process
AcrobatReader.StartInfo.FileName = "C:\Users\Win 10\Desktop\mjh.pdf"
AcrobatReader.Start()
pdfDoc.Close()
End Sub
End Class