When I add Unicode strings (such as Chinese characters) using the IText.AddContent() method to a report, it displays as blanks. Does the Documents engine supports Unicode? If so, could you show me how to do this properly?
Thanks,
Herbert
Hi Herbert,
The same question is discussed here: UltraGridDocumentExporter 2-byte word data problem - Infragistics Community
I have already set the style of the IText interface to use a Chinese font but it still generated blanks in PDF. If I generate an XPS, then it displays properly.
Here is the code (C++/CLI) that adds the Client cell to the table:
Documents::Graphics::Font ^ChFont = gcnew Documents::Graphics::Font(L"MingLiu",12,Documents::Graphics::FontStyle::Regular); Documents::Report::Text::Style ^ChStyle = gcnew Documents::Report::Text::Style(ChFont,Documents::Graphics::Brushes::Black); Cell = Row->AddCell(); Cell->Width = gcnew Documents::Report::RelativeWidth(20); Cell->Borders = gcnew Documents::Report::Borders(Documents::Graphics::Pens::Black); Cell->Paddings->All = 2; Txt = Cell->AddText(); Txt->Style = ChStyle; Txt->AddContent(L"兩小時預警");
MingLiu is a Chinese font from Windows. I have attached the generated PDF file. Note that the Client cell is blank.
Regards,
I just tested this out and it works fine for me. Here's the code I used:
Report report = new Report(); ISection section = report.AddSection(); IText text = section.AddText(); text.Style.Font = new Font("Arial", 12); text.AddContent("Arial"); text = section.AddText(); text.Style.Font = new Font("Arial Unicode MS", 12); text.AddContent("Arial Unicode MS"); text = section.AddText(); text.Style.Font = new Font("MingLiu", 12); text.AddContent("兩小時預警"); string fileName = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Application.ExecutablePath), "x.pdf"); report.Publish(fileName, FileFormat.PDF); Process.Start(fileName);
Mike,
Thank you for the sample code. Adobe Acrobat Reader can display both your code and my original code. However, Foxit PDF reader did not display the Chinese characters. I am just a little bit confused because Foxit can display other PDF with Chinese characters.
If Adobe Acrobat can display the PDF file correctly and FoxIt does not, then that sounds like it may be a bug in FoxIt.
Im trying to export PDF in Arabic using the Documents Engine,
text = section.AddTexttext.Style.Font = New Infragistics.Documents.Graphics.Font("Arabic Typesetting", 12)text.AddContent("السادة")text = section.AddText()text.Style.Font = New Infragistics.Documents.Graphics.Font("Arial Unicode MS", 12)text.AddContent("السادة")each letter printed in the PDF is seperated, it should be combined. see attached picture
font embeding didnt work either.any export file format gives the same result (xps,pdf,txt)
is there any workarond for this?
So... that PDF has ArialBold and ArialMT for fonts and the ArialMT is embedded which the engine will do when it encounters a glyph that falls outside the normal range of characters. Arial has no substitution for these glyphs and will continue to use the unknown glyph for those characters. If you change the font to be say "Microsoft JhengHei" then the Chinese characters display fine. To do that call AddContent with a style that uses the Microsoft JhengHei font or any other appropriate CJK (Chinese, Japanese, Korean) font.
The version of the engine you are using (10.3) does not get interpreted well into other readers such as Foxit Reader because of the approach for embedding and encoding the font information. The latest 12.1 and 12.2 Service Release and the subsequent 13.1 Volume Release use a new approach that is more readily interpreted by other readers and also allows the pdf to be rendered on other devices (such as an iPad and other mobile devices).
I used Arial font to render the whole report and it is not embedded. Since the user can input any language, I don't know ahead of time which font to embed. I have attached a sample report. The Custom 1 and Custom 2 columns contains Simplified Chinese characters. They are as follow: Custom 1 = 多个数据视图 and Custom 2: 数据预览屏幕. Both Custom 1 and 2 are not displayed when viewed in Adobe Acrobat Reader 9 or Foxit Reader 5.4.
Is there a better way to generate the report?
Thanks for your help.
We include a UnicodeMap to the PDF to allow the substitution of glyphs to take place when necessary. If the font doesn't support those glyphs though, they will still show as an unknown glyph (which we default the unknown to the box glyph). Which font are you trying to render the glyphs in? Is the font embedded in the PDF?
If the PDF is something that can be shared publicly go ahead and post it here and I'll look at the PDF and see what is going on, if not let me know and we'll make a case and get it resolved through your Developer Support Cases instead.
Hi
How can I get feedback about this idea?
Hello Andrew,
After some research, the "Arabic unicode support for PDF, XPS" has been determined to be a new product idea. I have sent your idea directly to our product management team.
Our product team chooses new ideas for development based on popular feedback from our customer base. Infragistics continues to monitor application development for all of our products, so as trends appear in requested features, we can plan accordingly.
We value your input, and our philosophy is to enhance our toolset based on customer feedback. If your idea is chosen for development, you will be notified at that time.
Your reference number for this product idea is PI12100100.
If you would like to follow up on your request at a later point, you may contact Developer Support management via email. Please include the reference number of your product idea in the subject and body of your email message. You can reach Developer Support management through the following email address: dsmanager@infragistics.com
Thank you for your request.