Linux File Conversion & Stamping Issues with Aspose.Words 21.6 / Aspose.PDF 22.12 and SkiaSharp 2.80.3

Hi Aspose Team,

We are facing an issue on Linux related to file conversion and stamping using Aspose libraries.


Environment Details

  • .NET Core: 3.1
  • OS: Linux (Amazon Linux 2)
  • Aspose Versions:
    • File Conversion → Aspose 21.6
    • Stamping → Aspose 22.12.0
  • SkiaSharp Versions: 2.80.3 (SkiaSharp.NativeAssets.Linux 2.80.3)

Workflow

  1. FileConversion job → Converts files to PDF using Aspose 21.6.
  2. Stamping job → Processes converted PDFs using Aspose 22.12.0.

Both projects target .NET Core 3.1.


Project Files

FileConversion.csproj

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Aspose.PDF" Version="21.6.0" />
    <PackageReference Include="Aspose.Words" Version="21.6.0" />
    <PackageReference Include="Aspose.Cells" Version="21.6.0" />
    <PackageReference Include="Aspose.Email" Version="21.6.0" />
    <PackageReference Include="Aspose.Imaging" Version="21.6.0" />
    <PackageReference Include="Aspose.Slides.NET" Version="21.6.0" />
    <PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.5" />
    <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.1.32" />
    <PackageReference Include="SkiaSharp" Version="2.80.3" />
    <PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="2.80.3" />
  </ItemGroup>
</Project>

StampingJob.csproj

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Magick.NET-Q16-AnyCPU" Version="13.1.3" />
    <PackageReference Include="PdfSharp.Core" Version="1.0.0" />
    <PackageReference Include="PdfiumViewer" Version="2.13.0" />
    <PackageReference Include="AWSSDK.Textract" Version="3.7.501.4" />
    <PackageReference Include="Aspose.PDF" Version="22.12.0" />
  </ItemGroup>
</Project>

Issue Observed

  • When running file conversion or stamping jobs, the Linux server restarts unexpectedly.
  • Hangfire marks jobs as completed, but no processing occurs.
  • Initially, we got this error:
Oct 24 15:56:57 ip-x-x-x-x.us-east-2.compute.internal x-x[2868]: Unhandled exception. System.TypeInitializationException: The type initializer for 'SkiaSharp.SKObject' threw an exce
Oct 24 15:56:57 ip-x-x-x-x.us-east-2.compute.internal x-x[2868]: ---> System.DllNotFoundException: Unable to load shared library 'libSkiaSharp' or one of its dependencies. In order
Oct 24 15:56:57 ip-x-x-x-x.us-east-2.compute.internal x-x[2868]: at SkiaSharp.SkiaApi.sk_version_get_milestone()
Oct 24 15:56:57 ip-x-x-x-x.us-east-2.compute.internal x-x[2868]: at SkiaSharp.SkiaSharpVersion.get_Native()
Oct 24 15:56:57 ip-x-x-x-x.us-east-2.compute.internal x-x[2868]: at SkiaSharp.SkiaSharpVersion.CheckNativeLibraryCompatible(Boolean throwIfIncompatible)
Oct 24 15:56:57 ip-1x0x12-x-x.us-east-2.compute.internal x-x[2868]: at SkiaSharp.SKObject..cctor()
  • After installing required dependencies:
sudo yum install -y cairo cairo-devel pango pango-devel freetype freetype-devel libpng libpng-devel
sudo yum install -y skia-sharp

The error disappeared, but the jobs appear as completed in Hangfire while the actual file conversion does not take place .

On Windows, the same workflow works without any issues.


Questions / Guidance Needed

  1. Are there additional native dependencies or configurations required for SkiaSharp / Aspose on Linux?
  2. Could mixing Aspose 21.6 (conversion) and Aspose 22.12 (stamping) cause compatibility issues?
  3. Would upgrading both projects to a consistent Aspose version help?

This issue is currently blocking our production workflow. Any guidance, workaround, or recommendation to get file conversion and stamping working reliably on Linux would be greatly appreciated.

Thanks in advance,

@ragu2736

Hello,

It seems you’re encountering issues with file conversion and stamping on a Linux environment using Aspose libraries. Here are some insights and recommendations based on your situation:

  1. Native Dependencies: You have already installed some required dependencies for SkiaSharp. However, ensure that all necessary libraries are present. You might also need to install libc6-dev, libglib2.0-dev, and libgdk-pixbuf2.0-dev, as they are often required for graphical operations in Linux environments.

  2. Version Compatibility: Mixing different versions of Aspose libraries (21.6 for conversion and 22.12 for stamping) can potentially lead to compatibility issues. It is advisable to upgrade both projects to a consistent version to avoid any unforeseen conflicts.

  3. Upgrading Aspose Libraries: Upgrading to the latest stable versions of both Aspose.Words and Aspose.PDF could resolve many issues, including performance and compatibility. Ensure that you test the new versions in a staging environment before deploying them to production.

  4. Debugging the Hangfire Jobs: Since the jobs are marked as completed in Hangfire but no processing occurs, consider adding logging to your conversion and stamping processes. This will help you identify where the failure happens. You can also check the Hangfire dashboard for any failed jobs or exceptions.

  5. Sample Code for Conversion: Here’s a minimal example of how to convert a document to PDF using Aspose.Words:

    using Aspose.Words;
    
    Document doc = new Document("input.docx");
    doc.Save("output.pdf");
    
  6. Testing in Isolation: If possible, run the conversion and stamping jobs in isolation to see if the issue persists. This can help determine if the problem is with the Aspose libraries or the environment setup.

If you continue to face issues, consider reaching out to Aspose support with detailed logs and error messages for further assistance.

Best of luck with your project!

@ragu2736,

Please see and follow up your thread for replies and for your reference.