Когда я пытаюсь этот код создавать PDF на арабском языке с использованием C#, сгенерированный PDF-файл содержит дискретные символы. Любая помощь, поэтому я не могу получить непрерывных персонажей?arabic encoding in itextsharp
//Create our document object
Document Doc = new Document(PageSize.LETTER);
//Create our file stream
using (FileStream fs = new FileStream(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Test.pdf"), FileMode.Create, FileAccess.Write, FileShare.Read))
{
//Bind PDF writer to document and stream
PdfWriter writer = PdfWriter.GetInstance(Doc, fs);
//Open document for writing
Doc.Open();
//Add a page
Doc.NewPage();
//Full path to the Unicode Arial file
string ARIALUNI_TFF = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Fonts), "arabtype.TTF");
//Create a base font object making sure to specify IDENTITY-H
BaseFont bf = BaseFont.CreateFont(ARIALUNI_TFF, BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
//Create a specific font object
iTextSharp.text.Font f = new iTextSharp.text.Font(bf, 12, iTextSharp.text.Font.NORMAL);
//Write some text, the last character is 0x0278 - LATIN SMALL LETTER PHI
Doc.Add(new Phrase("This is a ميسو ɸ", f));
//Write some more text, the last character is 0x0682 - ARABIC LETTER HAH WITH TWO DOTS VERTICAL ABOVE
Doc.Add(new Phrase("Hello\u0682", f));
//Close the PDF
Doc.Close();
}
Я был лицом этого проблема прежде, вы можете взглянуть на мой вопрос «Конвертировать арабский» unicode «content html или xml в pdf с помощью itextsharp», который может помочь вам http://stackoverflow.com/questions/16080741/convert-arabicunicode-content-html- или-XML-в-PDF-использования-itextsharp –