Registering a Fonts Folder
Our sample projects and report templates can help you learn the basics of working with our products.On the server you can point the engine to a folder of font files so all of them become available to reports.
Registering the resource. Load or register the external resource before rendering so the finished report remains portable across environments.
Registering the resource. Load or register the external resource before rendering so the finished report remains portable across environments.
var Stimulsoft = require('stimulsoft-reports-js');
Stimulsoft.Base.StiFontCollection.setFontsFolder('./Fonts');
var report = new Stimulsoft.Report.StiReport();
report.loadFile('FontsFolder.mrt');
report.renderAsync(() => {
var settings = new Stimulsoft.Report.Export.StiPdfExportSettings();
settings.embeddedFonts = true;
report.exportDocumentAsync((pdfData) => {
fs.writeFileSync('./FontsFolder.pdf', Buffer.from(pdfData));
}, Stimulsoft.Report.StiExportFormat.Pdf, null, settings);
});setFontsFolder makes every font in the folder available by name, and the PDF export setting embeddedFonts = true embeds the used fonts into the file so it displays correctly anywhere.