5
我写了一个PDF文档,我尝试用希伯来语(UTF-8)编写,并且我无法在Windows窗体中使用C#和Visual Studio 2010使用以下代码。希伯来语文本PDF
Document Doc = new Document(PageSize.LETTER);
//Create our file stream
using (FileStream fs = new FileStream("C:\\Users\\moshe\\Desktop\\Test18.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("C:\\Users\\moshe\\Desktop\\proj\\gold\\fop\\gold", "ARIAL.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);
//Write some text
Doc.Add(new Phrase("מה קורה", f));
//Write some more text
Doc.Add(new Phrase("תודה לכולם", f));
//Close the PDF
Doc.Close();
我把字体放在文件夹中。
我需要做什么?
我会震惊地发现,你不能设置运行方向以其他方式...嗯.. – 2011-05-26 00:53:58
@Mark Storer,我试着将它设置在我的'PdfWriter'对象本身上,但它似乎没有做任何事情,至少有一个'Phrase'和'Paragraph'。 – 2011-05-26 12:53:14
更多关于iText的文档,他们说PdfWriter.SetRunDirection只是一个占位符方法,这也是iTextSharp的源代码所说的。 – 2011-05-26 13:03:50