Free Support Forum - aspose.com

SkiaSharp exceptions on Linux

Hi,

We are encountering an exception when converting some documents to PDF. Our investigations show that the documents usually contain gradient fills, or similar drawing elements.

Please see the attached .NET Core code and test document to reproduce the error. The included test .docx file generates PDF successfully when run on a Windows server, but not on Linux (presumably because Aspose.Words uses SkiaSharp on Linux)?

Please see the Linux system details and console output below:

Aspose.Words 18.6.0

.NET Command Line Tools: (v2.1.105)

Commit SHA-1 hash: 141cc8d976

Ubuntu 18.04 LTS

OS Name: ubuntu
OS Version: 18.04
OS Platform: Linux
RID: ubuntu.18.04-x64
Base Path: /usr/share/dotnet/sdk/2.1.105/

.NET Core Shared Framework Host

Version : 2.0.7
Build : 2d61d0b043915bc948ebf98836fefe9ba942be11

Console output:

Hello World!

Unhandled Exception: System.ArgumentNullException: Value cannot be null.
Parameter name: bitmap
   at SkiaSharp.SKCanvas.DrawBitmap(SKBitmap bitmap, Single x, Single y, SKPaint paint)
   at   .(   , RectangleF )
   at   ..ctor(   , RectangleF )
   at   .(   )
   at   .(   ,    , RectangleF )
   at   .(   , RectangleF )
   at   .(   , RectangleF )
   at    .(   , Boolean , RectangleF )
   at   .(   )
   at   .    (   )
   at   .    (   )
   at   .    (   )
   at   .    (   )
   at   .    (   )
   at   .    (   )
   at  .    (   )
   at   .(    ,     )
   at   .     (    )
   at   .    (    )
   at Aspose.Words.Document.(    , SaveOptions )
   at Aspose.Words.Document.(Stream , String , SaveOptions )
   at BWDocToPdf.Program.Main(String[] args) in /home/userb/BWDev/BWExperi/BWDocToPdf/BWDocToPdf/Program.cs:line 13

@adrianpageup,

Thanks for your inquiry. To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document.
  • Please share the steps that you are using to reproduce this issue.
  • Please create a standalone console application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we’ll start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

Hi Tahir,

I did include a zipfile with my original post, but your forum seems to have removed it? Attaching again here for your reference.BWDocToPdf.zip (16.3 KB)

@adrianpageup,

Thanks for sharing the detail. The latest version of Aspose.Words for .NET 18.6 has dependency of SkiaSharp 1.59.1. You are facing this issue due to SkiaSharp 1.59.1. We have upgraded it to version 1.60.1. The fix of this issue will be available in next release of Aspose.Words.

Great news. Thanks for the quick response @tahir.manzoor.

Looking forward to the next release!

Best regards,
Adrian

The issues you have found earlier (filed as WORDSNET-16954) have been fixed in this Aspose.Words for .NET 18.7 update and this Aspose.Words for Java 18.7 update.