Dear Telerik Experts,
I am using Telerik UI for ASP.NET AJAX 2014 Q1, I am experiencing some issues which I could not explain. Basically I use a grid and want to export it to PDF, I simply call RadGrid1.MasterTableView.ExportToPdf(); to do so. The grid contains some chinese characters. It works fine in local debug, but when I deploy the website to Azure, the produced pdf with all characters showing as boxes. Initially I thought it was font not available issue but looks like the font indeed is available and it can be seen in acrobat reader, but it shows different code than the one that generated locally. The font used is called "楷体" which is a chinese font. The one that generated locally which works fine showing as 1DACA5+楷体 and 200101+楷体, the one generated from Azure website showing as 8A7FA8+楷体 and D66FD6+楷体. I attached the two files generated from my local machine and azure website for reference.
PDF generated locally:
PDF generated from azure website:
Could you please give some suggestions how I could possibly resolve this issue? I tried several things including try use different fonts and encode the page with different encoding(UTF-8, GB2312) but none of those works. I noticed even numbers are not showing properly in azure generated pdf. Unforturnately the suggested font "Arial Unicode MS" is not available in Azure website.
Any suggestions would be really appreciated!
Thanks in advance!
9 Answers, 1 is accepted
Note that the cause for this issue is that you need to set a font which has the chines characters and this font should be available on the server. Such font is the "Arial Unicode MS" that we have suggested but you can use any other font which contains those characters. Note that the font should be install on the server as well.
Thanks a lot for your reply! Basically I am using this font "楷体"(KaiTi) which has/support the chinese characters, also I have tried other fonts such as SimSun, Microsoft YaHei etc but they are having similar behaviors. The pdf generated from Azure websites are showing only boxes when the font which support Chinese characters presented on the server, if I use font that not available or font not support chinese characters it seems alphabertic and numerical characters are showing correctly but not the Chinese characters.
On the other hand, it looks like I do not have any control over installing fonts on Azure website, so probably there is no way I could possibly install "Arial Unicode MS" on Azure website server, if you know any possible solutions to install fonts on Azure websites, please let me know I would like to give a try.
So here I indeed used a font which should support chinese characters and the font is presented/installed on the server, but somehow the generated pdf is not showing correct characters for some reason. Could you please give some more suggestions? Thanks a lot!
Note that in case you have a font which support a Chinese characters installed on the sever then you can use it by setting
DefaultFontFamily property. Could you please verify that you have set the property before exporting the grid?
Thanks for the update! I have verified the font I used here support Chinese characters and it is installed on the server, I have set the font by assign DefaultFontFamily property before exporting. The generated pdf showing the font is enbeded by looking at the properties but all characters showing as boxes.
Thanks and please provide more advices!
Could you please provide your ExportSetting configuration and also a piece of the text to test it on our end? Additionally I would appreciate if you sent a link to the downloading page of the fort that you are using.
Hi Kostadin, thanks a lot for your reply! The following is the ExportSetting section:
<ExportSettings Pdf-ContentFilter="NoFilter" IgnorePaging="true" Excel-AutoFitImages="true" OpenInNewWindow="true" >
<Pdf PageHeight="210mm" PageWidth="297mm" DefaultFontFamily="楷体" AllowCopy="true" AllowModify="true" AllowPrinting="true" DisableContentEncryption="true" PageLeftMargin="10mm" PageTopMargin="45mm"
BorderStyle="Medium" BorderColor="#666666" ForceTextWrap="true">
The font I used here is called "楷体" in Chinese base OS or "KaiTi" in English based OS, it is a pre-installed font for windows, let me know if you could not find it on your test box.
Thanks a lot!
I just test the export on my side and as far as I can see it works correct. Keep in mind that you might need to set the default font as KaiTi. I prepared a small sample and I also attach the exported document so you can see the result. Please try the sample on your end and let me know about the result.