I am trying to generate pdf from xslfo and am experienced with the font issues
FontRepository.Sources.Clear();
FontRepository.Sources.Add(new
FolderFontSource(_fileSystem.GetAbsolutePathFor(Path.Combine(“Document”, “Fonts”))));
var defaultFont = FontRepository.FindFont(“Open Sans Regular”);
using var document = new Aspose.Pdf.Document(xslFoStream, new XslFoLoadOptions());
After document instance created: document.FontUtilities.GetAllFonts() returns list of fonts (Arial, Times New Roman)
var pdfStream = new MemoryStream();
document.Save(pdfStream, new PdfSaveOptions { DefaultFontName = defaultFont.BaseFont });
After saving target font has not been applied. Please advise.
To ensure a timely and accurate response, please attach the following resources here for testing:
Your input PDF and “Open Sans Regular” font.
Please attach the output PDF file that shows the undesired behavior.
Please attach the expected output PDF file that shows the desired behavior.
Please create a standalone console application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.
As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.
PS: To attach these resources, please zip and upload them.
actualResult.pdf - represents generated file
Actual result: font in pdf fall back to Times New Roman (on docker pod it is fallback to DejaVu Sans)
Expected result: pdf rendered with specified fond (OpenSans.ttf)
Also, is there any documentation or guide on how to configure fontconfig on my debian docker container to avoid using the default DejaVu?
We have logged this problem in our issue tracking system as PDFNET-52647. We will inform you once there is an update available on it. We apologize for your inconvenience.