Embedding a font as a report resource makes the template self-contained: it renders with the same typography on every machine, even where the font is not installed.

Register the font as a resource. Read the .ttf bytes and add them to the report dictionary:
var fileContent = File.ReadAllBytes("Fonts/Roboto-Black.ttf");
var resource = new StiResource("Roboto-Black", "Roboto-Black", false,
    StiResourceType.FontTtf, fileContent, false);
report.Dictionary.Resources.Add(resource);
Add it to the font collection. This lets the rendering engine resolve the font by name:
StiFontCollection.AddResourceFont(resource.Name, resource.Content, "ttf", resource.Alias);
Use the font. Reference it by family name on any component:
var text = new StiText(new RectangleD(1, 1, 3, 2));
text.Text = "Sample Text";
text.Font = StiFontCollection.CreateFont("Roboto-Black", 12, FontStyle.Regular);

How it works. Because the font travels inside the .mrt template, previews, prints and PDF/HTML exports all use the exact same glyphs — no environment-specific substitution.

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.