PowerPoint (PPT/PPTX) and Excel (XLS/XLSX) not converting to PDF on Amazon Linux EC2 (.NET Core 3.1, Aspose 21.6.0)

Hi Aspose Team,

We are facing an issue with file conversion on Amazon Linux 2 (EC2).
Our PPT/PPTX → PDF and XLS/XLSX → PDF conversions are not working.
No exceptions are thrown, but the PDF output is either not created or corrupted/blank.

The same code and files work perfectly on Windows.

:wrench: Environment Details

<PackageReference Include="Aspose.Slides.NET" Version="21.6.0" />

<PackageReference Include="Aspose.Cells" Version="21.6.0" />

.NET Core version: 3.1

Operating System: Amazon Linux 2 (EC2)

License: Not using a license (evaluation mode)

Fonts: Arial.ttf included in project path (ProductionServicev2/Fonts)

:brain: Issue Summary

On Amazon Linux 2:

PPT and XLS files fail to convert to PDF.

PDF is not generated or is corrupted/blank.

On Windows:

All conversions (Word, Text, PPT, Excel) work fine.

:test_tube: Code Example (Aspose.Slides)

private async Task<ConversionResult> ConvertToPdf(string inputFilePath, string outputPath)
{
    try
    {
        using (Presentation presentation = new Presentation(inputFilePath))
        {
            PdfOptions pdfOptions = new PdfOptions
            {
                JpegQuality = 100,
                TextCompression = PdfTextCompression.None
            };

            presentation.Save(outputPath, Aspose.Slides.Export.SaveFormat.Pdf, pdfOptions);
        }
        return ConversionResult.Successful(outputPath);
    }
    catch (Exception ex)
    {
        return ConversionResult.Failed(ex.Message);
    }
}

:question: Questions

Is Aspose.Slides/Cells 21.6.0 compatible with .NET Core 3.1 on Amazon Linux 2?

Are there any required dependencies (e.g., libgdiplus, fontconfig, or specific fonts) for file conversion on Linux?

Does Aspose need special configuration for headless Linux environments?

Would upgrading to a newer Aspose version help fix this issue?

:paperclip: Additional Info

Thanks for your help and guidance.

Best regards,
Ragu

@ragu2736

Short answer

  • Yes – Aspose.Slides 21.6.0 and Aspose.Cells 21.6.0 run on .NET Core 3.1 under Amazon Linux 2.
  • The only extra things you need on the OS are a few native graphics/font libraries and a folder that contains the TrueType fonts you want the converters to use.
  • No special “head‑less” switch is required – just make sure the native packages and the font folder are available before you call Presentation.Save or Workbook.Save.
  • Upgrading to a newer Aspose version (e.g. 25.x) gives you the latest bug‑fixes and a slimmer set of native dependencies, but it is not required to get the conversion working.

Below is a step‑by‑step checklist and a minimal, ready‑to‑run C# example that works on Amazon Linux 2.


:one: Install the required native libraries on Amazon Linux 2

# Update the package index
sudo yum update -y

# Install the graphics / font libraries that Aspose.Slides and Aspose.Cells rely on
sudo yum install -y \
    libgdiplus \
    fontconfig \
    freetype \
    libpng \
    libjpeg-turbo \
    libtiff \
    libX11   # required by libgdiplus

# Quick sanity check – the library should have all its dependencies resolved
ldd /usr/lib64/libgdiplus.so   # no “not found” entries

Why?
Both products use GDI+ (via libgdiplus) for some drawing operations and need fontconfig/ freetype to locate system fonts. Without these packages the PDF is created but contains no rendered content (blank or corrupted pages).


:two: Provide a folder with the fonts you need

mkdir -p /var/app/Fonts
cp /path/to/your/Arial.ttf /var/app/Fonts/
# add any other .ttf files you require (Times New Roman, Calibri, etc.)
chmod -R 755 /var/app/Fonts

You can ship the font files with your application or point to a system‑wide font directory.


:three: C# code – tell Aspose where the fonts are and perform the conversion

using System;
using Aspose.Slides;
using Aspose.Slides.Export;
using Aspose.Cells;
using Aspose.Cells.Pdf;   // PdfSaveOptions lives here

public static class PdfConverter
{
    // Folder that contains the .ttf files
    private const string FontsFolder = "/var/app/Fonts";

    // -------------------------------------------------
    // PowerPoint / PPTX → PDF
    // -------------------------------------------------
    public static void ConvertPptToPdf(string pptPath, string pdfPath)
    {
        // Global setting – works for all presentations loaded in this process
        Aspose.Slides.FontsFolder = FontsFolder;

        using (var pres = new Presentation(pptPath))
        {
            var pdfOpts = new PdfOptions
            {
                JpegQuality = 100,
                TextCompression = PdfTextCompression.None
            };

            pres.Save(pdfPath, SaveFormat.Pdf, pdfOpts);
        }
    }

    // -------------------------------------------------
    // Excel / XLSX → PDF
    // -------------------------------------------------
    public static void ConvertXlsToPdf(string xlsPath, string pdfPath)
    {
        // Required on Linux for some legacy Excel encodings
        System.Text.Encoding.RegisterProvider(
            System.Text.CodePagesEncodingProvider.Instance);

        // Global font folder for Aspose.Cells
        Aspose.Cells.FontsFolder = FontsFolder;

        using (var wb = new Workbook(xlsPath))
        {
            var pdfSaveOpts = new PdfSaveOptions
            {
                // Example: create a PDF/A‑1b compliant file
                Compliance = PdfCompliance.PdfA1b
            };

            wb.Save(pdfPath, pdfSaveOpts);
        }
    }
}

What the code does

Item Reason
Aspose.Slides.FontsFolder / Aspose.Cells.FontsFolder Guarantees the rendering engine can locate the TrueType fonts you supplied.
System.Text.Encoding.RegisterProvider Needed on Linux for older Excel files that use code‑pages not built into .NET Core.
PdfOptions / PdfSaveOptions Default settings are sufficient once the native libraries and fonts are present.

:four: Verify the conversion

dotnet run   # or call the methods from your service
ls -l output.pdf          # size should be > 0 KB
file output.pdf           # should report “PDF document”

If the PDF is still blank:

  1. Enable Aspose logging to see missing native dependencies:

    Aspose.Slides.Logging.LoggerFactory.SetLogger(
        new Aspose.Slides.Logging.ConsoleLogger());
    
  2. Check that fonts were loaded (Slides example):

    var fonts = pres.FontsManager.GetFonts();
    Console.WriteLine($"Loaded fonts: {fonts.Count}");
    

:five: Should you upgrade to a newer Aspose version?

Benefit Details
Bug‑fixes Later releases (e.g., 25.x) contain fixes for Linux rendering glitches that existed in the 21.x line.
Reduced native deps Newer builds no longer need libgdiplus for most operations; only fontconfig and freetype remain.
Support 21.6.0 is already out of mainstream support; newer versions receive security updates.

Recommendation – If you can rebuild the service, move to the latest stable Aspose.Slides and Aspose.Cells (currently 25.x). The code shown above works unchanged; you only need to update the NuGet package references.


:six: TL;DR checklist for Amazon Linux 2

Step Action
1. Install native libs sudo yum install -y libgdiplus fontconfig freetype libpng libjpeg-turbo libtiff libX11
2. Add fonts Copy required .ttf files to a folder (e.g., /var/app/Fonts).
3. Point Aspose to the fonts Set Aspose.Slides.FontsFolder and Aspose.Cells.FontsFolder (or use the same global folder).
4. Register code‑pages (Excel only) System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
5. Run conversion Use the ConvertPptToPdf / ConvertXlsToPdf methods above.
6. (Optional) Upgrade Update NuGet packages to the latest 25.x version for newest fixes.

Following these steps will make PPT/PPTX → PDF and XLS/XLSX → PDF work reliably on Amazon Linux 2 with .NET Core 3.1. If problems persist, capture the console output (with Aspose logging enabled) and look for messages about missing native libraries or fonts.

@ragu2736,
Thank you for contacting free support. Regarding Aspose.Slides, please note the following.

Currently, there are two main builds of Aspose.Slides for .NET:

Aspose.Slides for .NET

This is the main version of the product. It uses the standard .NET graphics engine.

  • On non-Windows platforms, you may need to install the libgdiplus library and its dependencies.
  • Prior to version Aspose.Slides 25.3, for non-Windows platforms, it was necessary to use the .NET Standard 2.0 DLL from the Aspose.Slides ZIP package.
  • Starting from version Aspose.Slides 25.3, the NuGet package can be used directly even on non-Windows systems.
  • When running on non-Windows systems, your application must include the following line at startup:
    AppContext.SetSwitch("System.Drawing.EnableUnixSupport", true);
  • Starting from version 25.3, you can use this package on platforms that support .NET, such as Linux aarch64 (ARM64).

Aspose.Slides for .NET6 CrossPlatform

This is the version of Aspose.Slides using a proprietary cross-platform graphics engine developed by the Aspose.Slides team.

On non-Windows platforms, the fontconfig library may be required.

Supported Platforms
  • Windows: x86, x86_64
  • Linux: x86_64
  • macOS: x86_64, ARM64
Planned for Future Support
  • Linux: aarch64 (ARM64) — ETA: end of 2025
Not Planned
  • Windows 11 ARM (ARM64) — Not currently under consideration

We hope this information is sufficient.

System Requirements|Aspose.Slides Documentation

Regarding Aspose.Cells, my colleagues from Aspose.Cells team will assist you shortly.
@amjad.sahi, FYI.

@ragu2736,

Regarding Aspose.Cells, since you are using .NET Core 3.1 along with an older version of Aspose.Cells (21.6.0), please note that at that time, the component relied on System.Drawing.Common instead of SkiaSharp. This may result in limited support on non-Windows operating systems.

Moreover, please do consider installing packages such as: libgdiplus for rendering graphics, fontconfig - install (or include) Microsoft-core fonts (if you rely on Windows fonts like Arial, Times New Roman, etc.). Furthermore, for fonts, if your spreadsheets use fonts not present on Linux, you must ensure those fonts are installed or embedded otherwise layout/rendering may behave differently, or conversion may fail. See the document for reference: Configuring Fonts for Rendering Spreadsheets|Documentation

Starting from Aspose.Cells version 22.10.1 for .NET 6+ platforms, SkiaSharp was introduced to enhance compatibility for non-Windows environments. To ensure optimal functionality and long-term compatibility, we recommend upgrading to .NET 6 (or later) and updating Aspose.Cells to a newer version that fully supports SkiaSharp on Linux, while also deploying the necessary native assets appropriately.