public static bool WordToPdf(string filePath, string outPath)
{
try
{
License license = new License();
license.SetLicense("xxxxx.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;
}
}
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
.