Fonts bullet images not rendering correctly using Aspose.Linq reportring engine

Hello Team,

I’ve a word template which contains bullet points with specific image like below:

Using Aspose.Linq reporting engine , we are trying to convert the word template into PDF. But the resulting PDF doesn’t show the correct bullets. It’s coming like below:

We are using Aspose.Words version Aspose Words 22.6 and the document generation engine is hosted on a Linux container.
What we have tried so far:

We have installed the below packages:

Aspose.Words.Shaping.HarfBuzz
harfbuzz
HarfBuzzSharp
HarfBuzzSharp.NativeAssets.Linux

install the libharfbuzz in the Linux container
Added the below line of code in the C# :

document.LayoutOptions.TextShaperFactory = Aspose.Words.Shaping.HarfBuzz.HarfBuzzTextShaperFactory.Instance;

Note: We are not loading the template from code behind. We are using Aspose.Linq reporting engine replace the tokens in runtime.

Attaching sample template and pdf output :

asposetest.docx (14.5 KB)
final.pdf (17.6 KB)

Any help would be appriciated…

@arindamk

It seems that you are experiencing issues with bullet points not rendering correctly when converting a Word template to PDF using the Aspose.Linq reporting engine. Here are some steps and considerations that may help resolve the problem:

  1. Ensure Proper Font Settings: Since you are using custom bullet images, it’s crucial to ensure that the fonts used in your Word template are correctly set up in your Linux environment. You have already installed the necessary packages, including Aspose.Words.Shaping.HarfBuzz, which is a good start.

  2. Set Text Shaper Factory: You mentioned that you have set the text shaper factory in your code. This is essential for enabling OpenType features, which can affect how text and bullets are rendered. Make sure that this line is executed before saving the document:

    document.LayoutOptions.TextShaperFactory = Aspose.Words.Shaping.HarfBuzz.HarfBuzzTextShaperFactory.Instance;
    
  3. Check for Font Availability: Ensure that the fonts used in your Word document are available in the Linux container. You can specify additional font sources if needed. For example, you can set up a folder containing the required fonts:

    FontSettings fontSettings = new FontSettings();
    fontSettings.SetFontsFolder("/path/to/your/fonts", true);
    document.FontSettings = fontSettings;
    
  4. Use Target Machine Fonts: If you are using specific fonts for bullet points, consider using the UseTargetMachineFonts option when saving the document. This can help in ensuring that the correct fonts are used during the conversion:

    HtmlFixedSaveOptions saveOptions = new HtmlFixedSaveOptions { UseTargetMachineFonts = true };
    document.Save("output.pdf", saveOptions);
    
  5. Debugging Font Substitution: If the bullets are still not rendering correctly, you can implement a warning callback to capture any font substitution warnings. This will help you identify if any fonts are missing or being substituted during the rendering process.

  6. Testing with Different Versions: If possible, test your implementation with a different version of Aspose.Words to see if the issue persists. Sometimes, specific versions may have bugs that are resolved in later releases.

By following these steps, you should be able to troubleshoot and potentially resolve the issue with bullet points not rendering correctly in your PDF output. If the problem continues, consider reaching out to Aspose support with detailed information about your setup and the specific issues you are encountering.

Sources:

@arindamk The problem might occur because fonts required to render the document are not availabe. The fonts are required to build document layout. 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/

In addition, please note, Aspose.Words does not support rendering colored glyphs. This feature request is logged as WORDSNET-22379.