While using Aspose.words to get document statistics including page count the page count returned is always incorrect when using the font ‘Open Sans’ is there a limitation with this font or any other font when using Document.PageCount on a docx file.
@IPOCTC The problem on your side might occur because the ‘Open Sans’ font used in your input document is not available on the machine where document is processed. The fonts are required to build document layout and calculate page count. If Aspose.Words cannot find the font used in the document, the font is substituted. This might lead into fonts mismatch and document layout differences due to the different fonts metrics. You can implement IWarningCallback to get notifications when font substitution is performed.
Please see our documentation to learn where Aspose.Words looks for fonts:
https://docs.aspose.com/words/net/specifying-truetype-fonts-location/
If after providing the required fonts the problem still persist, please attach your input document here for testing.
Hi, I have implemented the IWarningCallback and was surprised at some of the fonts that were substituted. If I am using Aspose.Words in a WebJob on Azure where would Aspose.Words look for fonts. I need to know the location so I can inform our customers of the fonts we support.
When implemented in this Azure architecture would the supported fonts possibly be the same as windows 11 installed system fonts?
Any help on the obtaining the list of supported fonts would be very much appreciated.
Thank you.
@IPOCTC Please see our documentation to learn where Aspose.Words looks for fonts:
https://docs.aspose.com/words/net/specifying-truetype-fonts-location/
You can use the following method to print the fonts available in the specified font sources:
/// <summary>
/// Prints the fonts avaialble in the specified font settings.
/// </summary>
public static void PrintAvaialbleFonts(FontSettings fs)
{
foreach (FontSourceBase fsb in fs.GetFontsSources())
{
Console.WriteLine(fsb.Type);
foreach (PhysicalFontInfo pfi in fsb.GetAvailableFonts())
{
Console.WriteLine(pfi.FullFontName);
}
Console.WriteLine("================================================");
}
}
If it is required to have the same set of fonts as installed in Windows 11, you should put these font in the environment where the document will be processed. For example you can put them into a separate folder and use this folder with fonts as fonts source as described in the article above.