Word to PDF(Aspose.Words 22.4.0) missing images

Greetings,

I’m having a problem with generating PDF document from WORD document on .NET Core 3.1 running on Linux
When generating PDF missing images。

Code:

public static bool WordToPdf(string filePath, string outPath)
{
    try
    {
        License license = new License();
        license.SetLicense("HY.Aspose.Word.lic");
        if (filePath.IsEmptyOrNull()) return false;
        if (outPath.IsEmptyOrNull()) return false;
        Document doc = new Document(filePath);
        doc.Save(outPath, SaveFormat.Pdf);
        return true;
    }
    catch (Exception e)
    {
        Console.WriteLine(e);
        return false;
    }
}

Environment:

  • .NET Core SDK 3.1
  • System : Linux centos7
  • Aspose.Words: 22.4.0 (NuGet package)

file.zip (162.6 KB)

@854421596 The problem occurs because Aspose.Words for .NET Standard uses 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.