Saving to PDF on Linux (Debian) with Mono framework

Hello, trying to evaluate the suitability of GemBox.Document for use in a common code base compiled in both Windows and Linux (Debian version 9) environments.

I am attempting to use the .net35 version of GemBox.Document.dll (v31.0.35.1197) and can compile and run the ‘hello world’ example under windows however when i build the solution on Debian under monodevelop an exception is raised when a call to document.Save() is made, the exception complains about being unable to load the ‘PresentationCore’ assembly version 3.0.0.0.

Would you expect the .net version of your library to work under mono? I may have misunderstood but ‘mono’ is listed as a supported platform.

I notice in your sample code there is an example of generating a document under Linux using the .Net Core version of GemBox.Document with the ‘Visual Studio Code’ application, at some point in the next year or so the intention is to port our application to .net core (another reason why i am evaluating GemBox.Document) but in the meantime we are stuck with .net and mono across our platforms.

If you think in principle it should work i will continue to try.

Thanks for reading
Gary

Further to this i see that ‘PresentationCore’ is part of the .net wpf library, i doubt there is an equivalent for this in mono.

Hi Gary,

GemBox.Document for .NET Framework does have some WPF dependencies.
However, note that GemBox.Document for .NET Standard doesn’t.

So, can you try using GemBox.Document for .NET Standard 2.0?
You can download it from our BugFixes page or from NuGet.
Note, you can use .NET Standard 2.0 libraries on Mono framework version 5.4 or above, see .NET Standard versions table.

I hope this helps.

Regards,
Mario

Thanks for the reply Mario.

I did try the .NET Standard 2.0 version of the GemBox.Document assembly from the evaluation version i originally downloaded but got a different error. In this case the exception is a System.TypeInitializationException, the inner exception complains of being unable to load the ‘System.Drawing.Common, Version=4.0.0.1’ assembly.

The mono runtime i am using is 6.8.0.105.
The sample app is targeting .NET framework 4.7.2.
I am using the GemBox.Document assembly from the .Net standard 20 folder, FileVersion 31.0.200.1197, File description = ‘GemBox.Document 3.1 for .NET Stand…’.

I repeated this using the link to the BugFixes page you referenced with the same results (i also noticed that the file versions were the same anyway).

Any idea what could be wrong?

Many thanks
Gary

Can you try adding System.Drawing.Common package, does this work for you?

Hi Mario, ‘System.Drawing.Common’ appears to be a .net core assembly, I obtained the nuget package and referenced the ‘netstandard2.0’ version in my mono example project (file version 4.6.26919.2).

Running with this gives a ‘PlatformNotSupportedException: System.Drawing is not supported on this platform’

I had a look on their git hub issues database and found this which suggests that ‘System.Drawing.Common’ is specific to the .net core runtime which is why the platform exception is raised when targeting the standard framework.

Gary

Hi Gary,

I looked at the package’s internal content and noticed that there is a “System.Drawing.Common.dll” file for the following targeted frameworks:

  • net461
  • netstandard2.0

But the following targeted frameworks don’t contain the DLL. They have a “_._” placeholder files to denote empty directories:

  • MonoAndroid10
  • MonoTouch10
  • xamarinios10
  • xamarinmac20
  • xamarintvos10
  • xamarinwatchos10

Anyway, can you try adding a direct reference to “System.Drawing.Common.dll” file from “net461”.
Looking at this GitHub issue it should be supported through libgdiplus usage.

I hope this helps.

Regards,
Mario

Hello, I can confirm that if i copy the ‘System.Drawing.Common.dll’ from the nuget package ‘net461’ folder and reference this file directly the example program works.

Many thanks
Gary

1 Like

Hi,

We have finally removed the GDI+ (System.Drawing.Common) dependency in GemBox components.

Please try again with this latest bugfix version:
https://www.gemboxsoftware.com/document/nightlybuilds/GBD35v1064.zip

Or this latest pre-released NuGet package:
Install-Package GemBox.Document -Version 35.0.1064-hotfix

I hope this helps.

Regards,
Mario