1 Commits

Author SHA1 Message Date
48377344a4 Added IRANSansWeb font as resource 2025-07-07 14:00:41 +03:30
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;
using Stimulsoft.Report.Export; using Stimulsoft.Report.Dictionary;
namespace PdfService; namespace PdfService;
@@ -11,6 +12,13 @@ public static class Reporter
report.LoadFromString(reportTemplate); report.LoadFromString(reportTemplate);
report.RegBusinessObject("Data", data); 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); report.Render(false);
var stream = new MemoryStream(); var stream = new MemoryStream();