Checkbox and header missing when converting word to pdf on linux server

Hi Aspose Team,

I would like to convert word the attached word document to pdf document
Original.docx (122.2 KB)
but has some issues:

  1. checkbox not rendered properly
  2. header missing
  3. line missing.

Below is the before and after conversion

aspose setup:

PackageReference Include=“Aspose.Words” Version=“24.3.0”
PackageReference Include=“Aspose.PDF.Drawing” Version=“24.3.0”

OS: Linux

below command has been executed as part of spinning up the container.
RUN apt-get install libfontconfig1
RUN apt-get update; apt-get install -y ttf-mscorefonts-installer fontconfig

Any suggestions? Thanks

@tinbird The problem is not reproducible on my side. Aspose.Words for .NET Standard and .NET Core use SkiaSharp to deal with graphics, to make it work on Linux you have to add reference either to SkiaSharp.NativeAssets.Linux or to SkiaSharp.NativeAssets.Linux.NoDependencies

If you add reference to SkiaSharp.NativeAssets.Linux, you should also install libfontconfig1 in your system. SkiaSharp.NativeAssets.Linux depends on this library. You can use the following command to install it:

apt-get update && apt-get install -y libfontconfig1

If you do not have rights to install packages, or other reasons not to install libfontconfig1, you can simply use SkiaSharp.NativeAssets.Linux.NoDependencies , which does not require installation of libfontconfig1.

Also, the problem on your side might occur because the fonts used in your input document are not available on the machine where document is processed. 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/

Here is PDF document produced on my side: out.pdf (145.0 KB)

1 Like

hi Alexey

thanks for the suggestions. it seems that the header is working fine now. however the Wingdings font used to generate the checkbox does not work fine as per attached file. Is there anyway we can make the checkbox work in linux server? Any way we can install the “wingdings” font in linux?
AKSLinuxDoco.pdf (127.6 KB)

@tinbird You can copy the required fonts in any older and set this folder as font’s source as specified in our documentation:
https://docs.aspose.com/words/net/specifying-truetype-fonts-location/

Hi Alexey, is there anyway that we can verify if a certain font (ie wingdings) have been installed in linux/ aks pod? Thanks.

@tinbird Sure, you can implement IWarningCallback to get notifications when font substitution is performed. If some font used in the document is not available, the warning callback will show a warning about the font substitution.
Also, you can use the following code to get list of fonts available in the specified font settings:

/// <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("================================================");
    }
}
1 Like