A single custom font file can be added to the engine and used in a report. This example loads one font and embeds it in the exported PDF.

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.addFontFile('./Font/LongCang-Regular.ttf');

var report = new Stimulsoft.Report.StiReport();
report.loadFile('SimpleList.mrt');

report.renderAsync(() => {
    var settings = new Stimulsoft.Report.Export.StiPdfExportSettings();
    settings.embeddedFonts = true;
    report.exportDocumentAsync((pdfData) => {
        fs.writeFileSync('./SimpleList.pdf', Buffer.from(pdfData));
    }, Stimulsoft.Report.StiExportFormat.Pdf, null, settings);
});
addFontFile registers an individual font file with the engine; combined with the embeddedFonts export setting, the font is baked into the PDF so the document looks the same on every machine.

By using this website, you agree to the use of cookies for analytics and personalized content. Cookies store useful information on your computer to help us improve efficiency and usability. For more information, please read the privacy policy and cookie policy.