Exporting rare Chinese characters to PDF results in them not being displayed

Stimulsoft Reports.NET discussion
xoao
Posts: 6
Joined: Wed Jun 01, 2022 3:16 am

Exporting rare Chinese characters to PDF results in them not being displayed

Post by xoao »

Exporting rare Chinese characters to PDF results in them not being displayed. The following is a sample code, using the Stimulsoft.Reports.Engine.NetCore 2023.3.1 version.
The attachment contains report.mrt and msyh.ttf.
WinFormsApp1.zip
(9.04 MiB) Downloaded 106 times

Code: Select all

private void button1_Click(object sender, EventArgs e)
{
    Stimulsoft.Base.StiFontCollection.AddFontFile("..\\..\\..\\data\\msyh.ttf", "微软雅黑");
    using (var stiReport = new Stimulsoft.Report.StiReport())
    {
        stiReport.Load("..\\..\\..\\data\\Report.mrt");
        stiReport.Render();
        stiReport.ExportDocument(Stimulsoft.Report.StiExportFormat.Pdf, "..\\..\\..\\data\\Report.pdf", new Stimulsoft.Report.Export.StiPdfExportSettings { EmbeddedFonts = true });
    }
}
Attachments
0.png
0.png (8.53 KiB) Viewed 1997 times
1.png
1.png (12.26 KiB) Viewed 1997 times
2.png
2.png (9.46 KiB) Viewed 1997 times
Lech Kulikowski
Posts: 7332
Joined: Tue Mar 20, 2018 5:34 am

Re: Exporting rare Chinese characters to PDF results in them not being displayed

Post by Lech Kulikowski »

Hello,

Please try to add the used font to the font collection:
Stimulsoft.Base.StiFontCollection.AddFontFile();

Thank you.
xoao
Posts: 6
Joined: Wed Jun 01, 2022 3:16 am

Re: Exporting rare Chinese characters to PDF results in them not being displayed

Post by xoao »

Please look at the code above, it already has the addition of Stimulsoft.Base.StiFontCollection.AddFontFile.
Lech Kulikowski
Posts: 7332
Joined: Tue Mar 20, 2018 5:34 am

Re: Exporting rare Chinese characters to PDF results in them not being displayed

Post by Lech Kulikowski »

Hello,

Please send us your report with test data and font file for analysis.

Thank you.
xoao
Posts: 6
Joined: Wed Jun 01, 2022 3:16 am

Re: Exporting rare Chinese characters to PDF results in them not being displayed

Post by xoao »

Report.mrt
(3.61 KiB) Downloaded 126 times
Lech Kulikowski
Posts: 7332
Joined: Tue Mar 20, 2018 5:34 am

Re: Exporting rare Chinese characters to PDF results in them not being displayed

Post by Lech Kulikowski »

Hello,

Most of the standard fonts do not contain national characters. In this case, Windows uses the "font fallback". This algorithm is very complicated and, therefore, is not realized in the exports.
To output national characters, please, use the font which contains all necessary characters. For example, the "Arial Unicode MS" font contains many national characters.
In your case, try to use the SimSun-ExtB font.

Thank you.
xoao
Posts: 6
Joined: Wed Jun 01, 2022 3:16 am

Re: Exporting rare Chinese characters to PDF results in them not being displayed

Post by xoao »

Tried using SimSun-ExtB, but got the same result, the PDF export doesn't display.
Lech Kulikowski
Posts: 7332
Joined: Tue Mar 20, 2018 5:34 am

Re: Exporting rare Chinese characters to PDF results in them not being displayed

Post by Lech Kulikowski »

Hello,

You should use the font that contains all the used symbols.

Thank you.
xoao
Posts: 6
Joined: Wed Jun 01, 2022 3:16 am

Re: Exporting rare Chinese characters to PDF results in them not being displayed

Post by xoao »

I used this font AlibabaPuHuiTi-3-35-Thin.ttf, and I have checked this font with FontCreator which includes the relevant characters, but there is still a problem exporting to PDF.
https://fonts.alibabadesign.com/Alibaba ... 5-Thin.zip
1.png
1.png (80.52 KiB) Viewed 1355 times
Lech Kulikowski
Posts: 7332
Joined: Tue Mar 20, 2018 5:34 am

Re: Exporting rare Chinese characters to PDF results in them not being displayed

Post by Lech Kulikowski »

Hello,

Your link is not working.

Thank you.
Post Reply