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

Cannot insert image. #434

Open
IngoManthey opened this issue Apr 4, 2024 · 10 comments
Open

Cannot insert image. #434

IngoManthey opened this issue Apr 4, 2024 · 10 comments

Comments

@IngoManthey
Copy link

In the previous versions I had no problems with the following code.
ImageSource.ImageSourceImpl ??= new ImageSharpImageSource<Rgba32>(); header.AddImage(ImageSource.FromFile(Invoice.Image));

Now I get the following exception:
System.MissingMethodException: Method not found: 'SixLabors.ImageSharp.Image1<!!0> SixLabors.ImageSharp.Image.Load(System.IO.Stream, SixLabors.ImageSharp.Formats.IImageFormat ByRef)'. at PdfSharpCore.Utils.ImageSharpImageSource1.FromStreamImpl(String name, Func1 imageStream, Nullable1 quality)
at MigraDocCore.DocumentObjectModel.MigraDoc.DocumentObjectModel.Shapes.ImageSource.FromStream(String name, Func1 imageStream, Nullable1 quality)
at PdfSharpCore.Drawing.XImage..ctor(Func1 stream) at PdfSharpCore.Drawing.XImage.FromStream(Func1 stream)

Can someone help me?

@balkarov
Copy link

balkarov commented Apr 4, 2024

I have the same problem. Any solution?

@IngoManthey
Copy link
Author

Unfortunately I didn't get an answer. Keep waiting for a solution.

@mtarlac
Copy link

mtarlac commented Apr 7, 2024

#426

@chrisg32
Copy link

chrisg32 commented Apr 8, 2024

@balkarov @IngoManthey Add package SixLabors.ImageSharp 2.1.7

@balkarov
Copy link

balkarov commented Apr 8, 2024

@chrisg32 I already use ImageSharp version 3.X

@chrisg32
Copy link

chrisg32 commented Apr 8, 2024

@balkarov ImageSharp version 3.X is not supported with PdfSharpCore. You have to stick with 2.X for now. That is the problem.

@IngoManthey
Copy link
Author

IngoManthey commented Apr 11, 2024

@chrisg32 I have

<PackageReference Include="SixLabors.ImageSharp" Version="2.1.7" />
<PackageReference Include="PdfSharpCore" Version="1.3.63" />

entered in the project. Unfortunately I still get the following erro
[08:57:34 ERR] InvoiceController.GetPrintInvoice System.MissingMethodException: Method not found: 'SixLabors.ImageSharp.Image1<!!0> SixLabors.ImageSharp.Image.Load(System.String, SixLabors.ImageSharp.Formats. IImageFormat ByRef)'. at PdfSharpCore.Utils.ImageSharpImageSource1.FromFileImpl(String path, Nullable`1 quality)

@chrisg32
Copy link

@IngoManthey That solution has work for me and a few others. Do you have any other projects in your solution that are referencing a higher version of image sharp?

I would suggest taking a look at the thread on #426 . @TonyValenti created a fork that adds support for the new image sharp. That could be an alternative for you until the package maintainers accept PR #427

@IngoManthey
Copy link
Author

@chrisg32 I found the mistake. In my project I used the MudExRichTextEditor library. This uses version 3.1.3, which is why I installed 3.1.3.
I would like to do without the library. Is there a way to use version?

@chrisg32
Copy link

@IngoManthey If you want to use 3.1.3 then you will need to use the fork mentioned in #426 or wait for PR #427.

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

4 participants