This is a migrated thread and some comments may be shown as answers.

pdf Export font/encoding problem in Azure

9 Answers 355 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bo
Top achievements
Rank 1
Bo asked on 25 Aug 2015, 08:07 AM

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:

http://videoconference.blob.core.chinacloudapi.cn/public/Good.pdf

PDF generated from azure website:

http://videoconference.blob.core.chinacloudapi.cn/public/Bad.pdf

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

Sort by
0
Bo
Top achievements
Rank 1
answered on 28 Aug 2015, 06:37 AM
Could someone please help out? Thanks!
0
Kostadin
Telerik team
answered on 28 Aug 2015, 06:51 AM
Hi Bo,

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. 

Regards,
Kostadin
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Bo
Top achievements
Rank 1
answered on 28 Aug 2015, 07:09 AM

Hi Kostadin,

 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!

Regards,

Bo

0
Bo
Top achievements
Rank 1
answered on 31 Aug 2015, 09:22 AM
Could someone give more advices? Thanks!
0
Kostadin
Telerik team
answered on 02 Sep 2015, 05:27 AM
Hello Bo,

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?

Regards,
Kostadin
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Bo
Top achievements
Rank 1
answered on 02 Sep 2015, 07:50 AM

Hi Kostadin,

 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!

Bo

0
Kostadin
Telerik team
answered on 07 Sep 2015, 05:40 AM
Hello Bo,

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.

Regards,
Kostadin
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Bo
Top achievements
Rank 1
answered on 08 Sep 2015, 09:20 AM

 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">
            </Pdf>
        </ExportSettings>

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!

Best regards,

Bo

0
Kostadin
Telerik team
answered on 11 Sep 2015, 06:54 AM
Hi Bo,

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.

Regards,
Kostadin
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Bo
Top achievements
Rank 1
Answers by
Bo
Top achievements
Rank 1
Kostadin
Telerik team
Share this question
or