Page 1 of 2

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

Posted: Thu May 08, 2025 3:32 am
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 118 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 });
    }
}

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

Posted: Thu May 08, 2025 7:19 am
by Lech Kulikowski
Hello,

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

Thank you.

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

Posted: Thu May 08, 2025 11:42 am
by xoao
Please look at the code above, it already has the addition of Stimulsoft.Base.StiFontCollection.AddFontFile.

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

Posted: Fri May 09, 2025 7:08 am
by Lech Kulikowski
Hello,

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

Thank you.

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

Posted: Fri May 09, 2025 8:43 am
by xoao
Report.mrt
(3.61 KiB) Downloaded 138 times

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

Posted: Fri May 09, 2025 12:21 pm
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.

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

Posted: Sat May 10, 2025 3:12 am
by xoao
Tried using SimSun-ExtB, but got the same result, the PDF export doesn't display.

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

Posted: Mon May 12, 2025 5:17 pm
by Lech Kulikowski
Hello,

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

Thank you.

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

Posted: Wed May 28, 2025 11:49 am
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 1391 times

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

Posted: Fri May 30, 2025 6:23 am
by Lech Kulikowski
Hello,

Your link is not working.

Thank you.