Gembox.Document Standard 2.0 System.InvalidOperationException: Bitmap shrinking failed. 'WPF' was not found on the system

Hello,
we use Gembox.Document v35.0.200.1423 on Windows, .NET Framework 4.7.1
In some cases we get the error when creating a PDF/A 2b document:
System.InvalidOperationException: Bitmap shrinking failed. ‘WPF’ (Windows Presentation Foundation for .NET 7 documentation | Microsoft Learn) was not found on the system. If the platform on which the application is running supports ‘WPF’, make sure that your project uses it. ‘System.Drawing’ (System.Drawing Namespace | Microsoft Learn) was not found on the system. If the platform on which the application is running supports ‘System.Drawing’, make sure that your project uses it. ‘SkiaSharp’ threw an exception of type ‘System.NullReferenceException’ and with message ‘Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.’. For more details about the exception, see the inner exception. ‘ImageSharp’ (GitHub - SixLabors/ImageSharp: 📷 A modern, cross-platform, 2D Graphics library for .NET) was not found on the system. If the platform on which the application is running supports ‘ImageSharp’, make sure that your project uses it. ‘GemBox’ threw an exception of type ‘System.NotSupportedException’ and with message ‘Die angegebene Methode wird nicht unterst tzt.’. —> System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt. bei .
(Stream , Double , Double , Double ) bei . . (
) bei . [TResult](Func2 , String ) --- Ende der internen Ausnahmestapel berwachung --- bei . [T](Exception[] , String ) bei . [TResult](Func2 , String ) bei . ( ) bei . ( ) bei .
( ) bei . ( ) bei .
( , ) bei . ( , , ) bei .
( , , ) bei . ( , , ) bei . ( , , , , Boolean , Predicate`1
, ) bei .
( , Int32 , , , ,
) bei . ( , , Int32 ) bei . (Int32 , Object , Object ) bei . ( , String , Stream ) bei GemBox.Document.PdfSaveOptions.67tg5rkvl9zwp8v7723mndgzuc3b4vj8 ( , Stream , Boolean ) bei GemBox.Document.PdfSaveOptions.67tg5rkvl9zwp8v7723mndgzuc3b4vj8 (DocumentModel , Stream , String ) bei GemBox.Document.DocumentModel.Save(Stream stream, SaveOptions options)

What is the reason for the exception and what can we do against it?

We intentionally use the .NET standard variant of Gembox.Document because we create the PDFs in a server component and previously had repeated exceptions regarding the WPF dispatcher and it was also the recommendation of Gembox support to use the .NET standard variant. to avoid WPF.

Best regards
Martin Schmeller

Hi Martin,

It seems that there is some image processing being done but there is no library that can be used for it.
For instance, can you please try again by adding a SkiaSharp:

Also, just in case, can you please try again with this current latest bugfix version:
https://www.gemboxsoftware.com/document/nightlybuilds/GBD35v1553Standard.zip

If the problem remains, please send us a small Visual Studio project that reproduces your issue so that we can investigate it.

Regards,
Mario

Hi Mario,
we already deploy SkiaSharp together with Gembox.Document because it’s a dependency in the Gembox.Document .Net Standard 2.0 NuGet-Package.
As you can see in the exception callstack SkiaSharp seems to be loaded:
*‘SkiaSharp’ threw an exception of type ‘System.NullReferenceException’ and with message ‘Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.’

I see now, you’re right, it seems the issue is related to the SkiaSharp usage.
Anyway, please send us a small Visual Studio project that reproduces your issue so that we can investigate it.