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.

Используя этот сайт, вы соглашаетесь на использование файлов Cookie для аналитики и персонализированного контента. Файлы Cookie хранят полезную информацию на вашем компьютере, чтобы помочь нам повысить эффективность и удобство использования. Для получения дополнительной информации, пожалуйста, прочтите Конфиденциальность и Использование Cookie.