Using a Custom Font
Наши примеры проектов и шаблоны отчётов помогут Вам разобраться в основах работы с нашими продуктами.A custom font can be registered with the engine so it embeds into the exported dashboard — text renders identically anywhere.
Add the font, then export.
How it works. The engine resolves and embeds the registered font during export, so custom typography survives into the output file.
Add the font, then export.
var Stimulsoft = require('stimulsoft-dashboards-js');
Stimulsoft.Base.StiFontCollection.addFontFile('./Font/LongCang-Regular.ttf');
var report = Stimulsoft.Report.StiReport.createNewDashboard();
report.loadFile("Dashboard.mrt");
report.exportDocumentAsync(function (pdfData) {
require('fs').writeFileSync('./Dashboard.pdf', Buffer.from(pdfData));
}, Stimulsoft.Report.StiExportFormat.Pdf);StiFontCollection.addFontFile(path)— register a.ttfwith the engine before rendering.- The font is embedded into the exported PDF, so the document displays correctly even where the font is not installed.
How it works. The engine resolves and embeds the registered font during export, so custom typography survives into the output file.