Hi,
I have attached a small videos, but just in case i cant open, let me try to describe my case.
You have recommended to add the fonts using the Sti Collection, i have done that which works, however, in relation to the PDF A3 Complience it doesnt work. It says there is not Font Embedded, as soon as i add the fonts to the resources, the pdf A3 Compliance works as normal.
My point is, how to avoid show the duplicated fonts in the dropdown? Or if you have a better way with a step by step how to Add fonts correctly where follow the A3 Compliance also, would be great.
I have added the same document as i was validating also in case you need.
Thank you so much for your support so far.
Let me know if you need something else, or we can make a video call in case you allowed and you are free, of course.
Here is the code i am trying to add with StiCollection
Code: Select all
private async addFontsToReportWithStiFontCollection() {
console.log("Count Resources: ", this.stiReport.dictionary.resources.count);
// await this.addFontsToReportWithStiResource();
let fontFolderPath = "assets/fonts/";
let fontNames = [
'Arial.ttf',
'Arial-Bold.ttf',
'Arial-Bold-Italic.ttf',
'Roboto-Black.ttf',
'Roboto-Black-Italic.ttf',
'Roboto-Bold.ttf',
'Roboto-Bold-Italic.ttf',
'Roboto-Italic.ttf',
'Roboto-Light.ttf',
'Roboto-Light-Italic.ttf',
'Roboto-Medium.ttf',
'Roboto-Medium-Italic.ttf',
'Roboto-Regular.ttf',
'Roboto-Thin.ttf',
'Roboto-Thin-Italic.ttf'
];
Stimulsoft.Base.StiFontCollection.addOpentypeFontFile(`${fontFolderPath}Arial.ttf`, `Arial`, Stimulsoft.System.Drawing.FontStyle.Regular, false);
Stimulsoft.Base.StiFontCollection.addOpentypeFontFile(`${fontFolderPath}Arial-Bold.ttf`, `Arial-Bold`, Stimulsoft.System.Drawing.FontStyle.Bold, false);
Stimulsoft.Base.StiFontCollection.addOpentypeFontFile(`${fontFolderPath}Roboto-Black.ttf`, `Roboto-Black`, Stimulsoft.System.Drawing.FontStyle.Bold, false);
Stimulsoft.Base.StiFontCollection.addOpentypeFontFile(`${fontFolderPath}Roboto-Black-Italic.ttf`, `Roboto-Black-Italic`, Stimulsoft.System.Drawing.FontStyle.Bold | Stimulsoft.System.Drawing.FontStyle.Italic, false);
Stimulsoft.Base.StiFontCollection.addOpentypeFontFile(`${fontFolderPath}Roboto-Bold.ttf`, `Roboto-Bold`, Stimulsoft.System.Drawing.FontStyle.Bold, false);
Stimulsoft.Base.StiFontCollection.addOpentypeFontFile(`${fontFolderPath}Roboto-Bold-Italic.ttf`, `Roboto-Bold-Italic`, Stimulsoft.System.Drawing.FontStyle.Bold | Stimulsoft.System.Drawing.FontStyle.Italic, false);
Stimulsoft.Base.StiFontCollection.addOpentypeFontFile(`${fontFolderPath}Roboto-Italic.ttf`, `Roboto-Italic`, Stimulsoft.System.Drawing.FontStyle.Italic, false);
Stimulsoft.Base.StiFontCollection.addOpentypeFontFile(`${fontFolderPath}Roboto-Light.ttf`, `Roboto-Light`, Stimulsoft.System.Drawing.FontStyle.Regular, false);
Stimulsoft.Base.StiFontCollection.addOpentypeFontFile(`${fontFolderPath}Roboto-Light-Italic.ttf`, `Roboto-Light-Italic`, Stimulsoft.System.Drawing.FontStyle.Regular | Stimulsoft.System.Drawing.FontStyle.Italic, false);
Stimulsoft.Base.StiFontCollection.addOpentypeFontFile(`${fontFolderPath}Roboto-Medium.ttf`, `Roboto-Medium`, Stimulsoft.System.Drawing.FontStyle.Regular, false);
Stimulsoft.Base.StiFontCollection.addOpentypeFontFile(`${fontFolderPath}Roboto-Medium-Italic.ttf`, `Roboto-Medium-Italic`, Stimulsoft.System.Drawing.FontStyle.Regular | Stimulsoft.System.Drawing.FontStyle.Italic, false);
Stimulsoft.Base.StiFontCollection.addOpentypeFontFile(`${fontFolderPath}Roboto-Regular.ttf`, `Roboto-Regular`, Stimulsoft.System.Drawing.FontStyle.Regular, false);
Stimulsoft.Base.StiFontCollection.addOpentypeFontFile(`${fontFolderPath}Roboto-Thin.ttf`, `Roboto-Thin`, Stimulsoft.System.Drawing.FontStyle.Regular, false);
Stimulsoft.Base.StiFontCollection.addOpentypeFontFile(`${fontFolderPath}Roboto-Thin-Italic.ttf`, `Roboto-Thin-Italic`, Stimulsoft.System.Drawing.FontStyle.Regular | Stimulsoft.System.Drawing.FontStyle.Italic, false);
let fontAlias = `Arial.ttf`.split('.')[0];
let fontNameWithoutdash = fontAlias.replace('-', ' ');
let fileContent = Stimulsoft.System.IO.File.getFile(`${fontFolderPath}Arial.ttf`, true, 'application/octet-stream', [], true, false, true);
let resource = new Stimulsoft.Report.Dictionary.StiResource(
fontNameWithoutdash, null, false, Stimulsoft.Report.Dictionary.StiResourceType.FontTtf, fileContent, false);
this.stiReport.dictionary.resources.add(resource);
}