Page 1 of 1

Custom fonts not applied in exported PDF

Posted: Sat Dec 19, 2020 3:51 pm
by AlharbiN
Hi,
In the designer, the font is perfectly displayed.
The font is a ttf file.

Here is my code

Code: Select all


                            StiPdfExportSettings pdfSettings = new StiPdfExportSettings();
                            pdfSettings.EmbeddedFonts = true;

                            report = StiReport.GetReportFromAssembly(assemplyfile);
                            StiOptions.Export.Pdf.AllowImportSystemLibraries = true;

                            report.RegData("CertificateData", certificateData);
                            await report.RenderAsync();
                            StiOptions.Export.Pdf.AllowImportSystemLibraries = true;
                            var service = new StiPdfExportService();
                            var stream = new MemoryStream();
                            service.ExportTo(report, stream, pdfSettings);
                            var streamArray = stream.ToArray();

                            System.IO.File.WriteAllBytes(certificateFile, streamArray);

the output file looks like the attached file

How can we solve this issue, please?
2020-12-19_18-48-35.jpg
2020-12-19_18-48-35.jpg (31.46 KiB) Viewed 1520 times

Re: Custom fonts not applied in exported PDF

Posted: Sun Dec 20, 2020 4:33 am
by Andrew
Hello.

Most of the standard fonts does 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 contain all necessary characters. For example, the "Arial Unicode MS" font contains many national characters.

Please see the video how to ass cutoms fonts https://www.youtube.com/watch?v=JtqJ9ZzY7_I

Thank you.