Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux Container and System.Drawing.Common Library Errors #69

Open
eoehen opened this issue Mar 2, 2022 · 11 comments
Open

Linux Container and System.Drawing.Common Library Errors #69

eoehen opened this issue Mar 2, 2022 · 11 comments

Comments

@eoehen
Copy link

eoehen commented Mar 2, 2022

I have problems to run scryber in a .net 6 linux container.

FROM mcr.microsoft.com/dotnet/aspnet:6.0
...

The Installation the library libgdiplus does not seem to solve the problem.
https://github.com/richard-scryber/scryber.core/blob/master/docs/libgdiplus.md

An unhandled exception was thrown by the application.
Exception: Scryber.PDFLayoutException: The layout of component \u0027text1\u0027 failed. The initialization of the fonts failed. The type initializer for \u0027Gdip\u0027 threw an exception.  
System.Configuration.ConfigurationErrorsException: The initialization of the fonts failed. The type initializer for \u0027Gdip\u0027 threw an exception.
System.TypeInitializationException: The type initializer for \u0027Gdip\u0027 threw an exception.  ---\u003E System.PlatformNotSupportedException: System.Drawing.Common is not supported on non-Windows platforms. 

System.Drawing is a windows only library.
https://docs.microsoft.com/en-us/dotnet/core/compatibility/core-libraries/6.0/system-drawing-common-windows-only

Recommended action is to migrate to one of the following libraries:

  • SkiaSharp
  • ImageSharp
  • Microsoft.Maui.Graphics

What is the meaning about this? Should we migrate scryber.core to SkiaSharp?
@richard-scryber or @VincentNikkelen If you want, I can try to do this migration.

By the way.
I think the culture info in the unit test should be defined otherwise some tests f.e. with datetime will failing in some
environments.

Or is there an other solution for this problem?

Thank you for your feedback.

Originally posted by @eoehen in #68

@Jogai
Copy link

Jogai commented Mar 3, 2022

ImageSharp is cross platform, and a really awesome project.

@eoehen
Copy link
Author

eoehen commented Mar 3, 2022

@Jogai
I don't care which library. Do you have experience with it and could you help?
My goal would be that scryber.core runs under linux in a linux container.
But I want to wait for the feedback from @richard-scryber .

@Jogai
Copy link

Jogai commented Mar 3, 2022

I have experience with the predecessor and followed development. Its really impressive what they did. (And i have huge respect for @JimBobSquarePants)

As for helping that would be more an issue with time than anything else, but I'm in need of generating PDF's in a linux container so I might have to jump in at some point anyway.

@eoehen
Copy link
Author

eoehen commented Mar 5, 2022

@richard-scryber
Thank you very much for your great pdf renderer.

Unfortunately I was not aware that your library does not run in a linux container. However, I absolutely need a library that runs in a linux container.

I have invested time to change scryber.core from System.Drawing to SkiaSharp. The first tests have shown that the changes in the fonts area was successful. But for the adjustment in the ImageFormatParser I lack the necessary knowledge. I need help with all this cases.

Can you please give me some feedback on this issue? What's your plan. Can we tackle this issue together, or is it not a priority for you?

On the other hand, I am forced to switch to another library, which I would find extremely unfortunate.

@eoehen
Copy link
Author

eoehen commented Mar 15, 2022

Dear @richard-scryber
I add a proposal to use SkiaSharp for Fonts. I prepared a solution to use SkiaSharp for colors and It looks like I have a solution for parsing images with SkiaSharp, but I need feedback.

It would be great to hear from you soon.

@EndOfTheSpline
Copy link

Any updates on Linux compatibility? I would also be very interested in running Scryber under Linux, preferably in a container. I would also be willing to help out with that to the best of my abilities.

Regarding the library, I would prefer not to use ImageSharp due to the licensing.

@Jogai
Copy link

Jogai commented Sep 22, 2022

What's wrong with the apache 2 license? (which would apply here: https://docs.sixlabors.com/articles/imagesharp.web/#license)

@EndOfTheSpline
Copy link

Because the Apache 2 license only applies for "non-commercial" projects, which are fairly limited for certain applications, as outlined in the repository's LICENSE;

Works in Source or Object form are licensed to You under the Apache License, Version 2.0 if.

  • You are consuming the Work in for use in software licensed under an Open Source or Source Available license.
  • You are consuming the Work as a Transitive Package Dependency.
  • You are consuming the Work as a Direct Package Dependency in the capacity of a For-profit company/individual with
    less than 1M USD annual gross revenue.
  • You are consuming the Work as a Direct Package Dependency in the capacity of a Non-profit organization
    or Registered Charity.

They've announced a license change about three years ago, and the uncertainty about what the licensing would look like (pricing, permissions, and so forth) had required us to move to alternatives instead. So in a way, ImageSharp is a bit of a hot topic here.

@JimBobSquarePants
Copy link

That doesn’t apply to this library though? The new license is explicitly non viral so any consumers of this library, commercial or otherwise are subject to the Apache license due to the deferral clause in the license.

Licenses are granted based upon You meeting the qualified criteria as stated. Once granted,
You must reference the granted license only in all documentation.

@Jogai
Copy link

Jogai commented Sep 23, 2022

@EndOfTheSpline The first bullet point applies here and the second to all dependants of this project. I dont see a problem.

@richard-scryber
Copy link
Owner

@EndOfTheSpline - Just really starting to get back into this after a 6 month break. There is a beta package that supports net6.0 and net standard 2.0 uploaded to Nuget (6.0.0.8-beta as of now). I'm running on Mac, and working well. I've also pushed this as a blazor wasm app onto cloudflare pages as a static site - that is working awesomely! Linus should not now be an issue. Would love feedback! :-)

Also getting this into a docker container would be a great thing.

As for the license - I am no expert, but @JimBobSquarePants - really appreciate your input. At the moment my expectation is that as this license is open, and anyone using Scryber will have a transitive package dependancy on ImageSharp then it should be ok. @Jogai - your input is appreciated too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants