Added IRANSansWeb font as resource

This commit is contained in:
2025-07-07 13:53:34 +03:30
parent df405dc69c
commit 48377344a4
2 changed files with 9 additions and 1 deletions

Binary file not shown.

View File

@@ -1,5 +1,6 @@
using Stimulsoft.Base;
using Stimulsoft.Report;
using Stimulsoft.Report.Export;
using Stimulsoft.Report.Dictionary;
namespace PdfService;
@@ -11,6 +12,13 @@ public static class Reporter
report.LoadFromString(reportTemplate);
report.RegBusinessObject("Data", data);
var currentDirectory = Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, @"../../.."));
var fileContent = File.ReadAllBytes(Path.Combine(currentDirectory, "Fonts", "IRANSansWeb.ttf"));
var resource = new StiResource("IRANSansMonoSpacedNum", "IRANSansMonoSpacedNum", false, StiResourceType.FontTtf, fileContent, false);
report.Dictionary.Resources.Add(resource);
StiFontCollection.AddResourceFont(resource.Name, resource.Content, "ttf", resource.Alias);
report.Render(false);
var stream = new MemoryStream();