PowerPointのPDF変換がLinuxでできない

こんにちは。
AsposeTotal .NETを使っています。WordやExcelをPDFに変換することはできたのですが、PowerPointをPDFに変換するとエラーになります。

  • Aspose.Total: 24.10.0
  • SkiaSharp.NativeAssets.Linux: 2.88.9
  • .NET v9
  • Docker: mcr.microsoft.com/dotnet/sdk:9.0-noble

エラーメッセージ

The type initializer for ‘Gdip’ threw an exception.

サンプルコード

var presentation = new Presentation(stream);
using (var pdfStream = new MemoryStream())
{
  presentation.Save(pdfStream, Export.SaveFormat.Pdf);
}

Dockerfile

FROM mcr.microsoft.com/dotnet/sdk:9.0-noble
WORKDIR /app

RUN apt update && \
    apt install -y fonts-ipafont fonts-ipaexfont fontconfig \
                   apt-utils libgdiplus libc6-dev && \
    fc-cache -fv

エラーメッセージから System.drawing.common がLinuxでサポートされなくなった事が原因だと思いますが、libgdiplusをインストールしても改善しませんでした。他に確認すべきことがありますか?

@YOkamoto,
無料サポートにお問い合わせいただきありがとうございます。

Aspose.Total NuGetパッケージには、クロスプラットフォームではないAspose.Slides for .NETが含まれており、使用時にお客様が直面されたようなエラーが発生する可能性があります。Linuxシステムでは、Aspose.Slides.NET6.CrossPlatformまたはZIPパッケージからのクロスプラットフォームバージョンを使用する必要があります。ご不便をおかけして申し訳ありません。

Aspose.Slides for .NET 6 Cross Platform|Aspose.Slides Documentation

返信有り難うございます。

Aspose.Slides.NET6.CrossPlatform v25.1.0で検証してみました。異なるエラーメッセージが表示されました。もしかしてArm64のサポートはされていないということでしょうか? Apple SiliconのDockerで開発をしています。

Unhandled exception. Aspose.Slides.PptxReadException: The type initializer for ‘’ threw an exception.
—> System.TypeInitializationException: The type initializer for ‘’ threw an exception.
—> System.PlatformNotSupportedException: linux-arm64, Arm64
at .(String , Assembly, Nullable`1 )
at System.Runtime.InteropServices.NativeLibrary.LoadLibraryCallbackStub(String libraryName, Assembly assembly, Boolean hasDllImportSearchPathFlags, UInt32 dllImportSearchPathFlags)
at .d(Int32 d, Int32 v, Int32 c, IntPtr& t)
at System.Drawing.Bitmap…ctor(Int32 width, Int32 height, PixelFormat format)
at System.Drawing.Bitmap…ctor(Int32 width, Int32 height)
at …cctor()
— End of inner exception stack trace —
at …ctor(Presentation )
at …ctor(TextFrame )
at Aspose.Slides.TextFrame…ctor( )
at Aspose.Slides.AutoShape()
at .(IAutoShape , , )
at .( , IGroupShape, )
at .(IGroupShape , , )
at .(IBaseSlide , , )
at .(IMasterSlide )
at.(IPresentation )
at .( , IPresentation)
at .(Presentation , Stream, InterruptionToken )
— End of inner exception stack trace —
at .(Presentation , Stream, InterruptionToken )
at Aspose.Slides.Presentation(Stream , Boolean)
at Aspose.Slides.Presentation.(Stream , Boolean)
at Aspose.Slides.Presentation…ctor(Stream stream, LoadOptions loadOptions)
at Aspose.Slides.Presentation…ctor(Stream stream)
at Program.$(String[] args) in /app/Program.cs:line 8

サンプルコードは以下です。

// See https://aka.ms/new-console-template for more information
using Aspose.Slides;

var slideLicense = new Aspose.Slides.License();
slideLicense.SetLicense("Aspose.Totalfor.NET.lic");

var stream = new StreamReader("sample-en.pptx");
var presentation = new Presentation(stream.BaseStream);
presentation.Save("sample-en.pdf", Aspose.Slides.Export.SaveFormat.Pdf);

利用しているPowerPointです。

sample-en.pptx.zip (25.4 KB)

@YOkamoto,
問題に取り組んでいますので、追ってご連絡いたします。

@YOkamoto,
Aspose.Slides for .NET6 CrossPlatform は macOS 上で動作し、ARM64 アーキテクチャをサポートしています。
System Requirements|Aspose.Slides Documentation

macOS で Aspose.Slides.NET6.CrossPlatform を実行するには、fontconfig パッケージをインストールする必要があります。

$ brew install fontconfig

添付のファイル「SLIDESNET_44689_console.zip」には、ライセンスを読み込み、空のプレゼンテーションを作成する .NET 7 のコンソールアプリケーションプロジェクトが含まれています。単に Aspose.Total.NET.lic ファイルをプロジェクトフォルダに配置し、debug.sh または release.sh を実行するだけです。
SLIDESNET_44689_console.zip (1.8 KB)
お役に立てば幸いです。

@andrey.potapov 確認ありがとうございます。紛らわしいのですが、Apple Silicon macOS上のDocker: mcr.microsoft.com/dotnet/sdk:9.0-nobleで開発をしています。

mcr.microsoft.com/dotnet/sdkはArmのサポートをしているため、Apple Siliconでも動作します。
https://mcr.microsoft.com/v2/dotnet/sdk/tags/list

@YOkamoto,
エラーを再現するための最小限のスタンドアロンプロジェクトを共有していただけますか?

aspose-sandbox-dotnet.zip (32.1 KB)

こちらサンプルプロジェクトとDocker Composeのファイルです。よろしくお願いします。 @andrey.potapov

@YOkamoto,
サンプルプロジェクトをありがとうございます。

当社の内部課題管理システムにおいて、以下の新しいチケットを作成しました。Free Support Policies に記載されている条件に従って、この問題を調査いたします

Issue ID(s): SLIDESNET-44839

優先的なサポートが必要な場合は、Paid Support Services から有料サポートをご利用いただけます。有料サポートでは、当社の有料サポート管理チームへの直接的なアクセスもご利用いただけます。

1 Like