I am integrating PDF support into our company's product at the moment, and for the most part it is working fine. Quite often, we need to add non-UK characters to the exported PDF. This works for mainland European character strings like "éâàâÔ", but does not appear to work for strings from further afield. The sample string I tried was:
أداة إزالة البرامج الضارة لـ
(Don't ask me what it means or what language it is, something to do with Microsoft)
This renders as
???? ????? ??????? ?????? ??
I have also tried using DrawStringRtf(), but that just displays it as a blank.
Is there a setting I need to change to allow full UTF-8 support?
Thanks
Here's a cut down version of the code:
Font font = new Font("Arial", 8); // center vertically StringFormat sform = new StringFormat(); sform.Alignment = StringAlignment.Near; sform.LineAlignment = StringAlignment.Center; myPDFObject.DrawString(text, font, Brushes.Black, rcCell, sform);
Attached is a test I've knocked up, hope it's useful (C# console application, writes a PDF to c:\TestHarness)
I tried to attach the whole solution as a zip, but it failed for some reason, so here' the source code:
using
{
pdf.NewPage();
rcPage.Inflate(-72, -72);
#endregion
}
It might be worth mentioning that I'm having similar problems with Japanese characters:
のソフトウェア just renders as ???????
アプリケーション拡張 partially renders, it comes out as ????ー???拡?
I have support for East Asian languages turned on for my OS (Windows XP), and also support for complex script and right-to-left languages.
I also use your XLS component to export the same data, but that works fine.
Have solved this now, added the following line:
pdf.FontType = FontTypeEnum.Embedded;
where 'pdf' is the C1PdfDocument instance you are using
Has anyone seen this using:
// Draw the PDF c1pdf.DrawImage(img, c1pdf.PageRectangle);
instead of DrawString?