SixLabors / ImageSharp

:camera: A modern, cross-platform, 2D Graphics library for .NET
https://sixlabors.com/products/imagesharp/
Other
7.49k stars 850 forks source link

Issue for load image in table cell in ver. 3.1.4 #2757

Closed prizmasoftware closed 5 months ago

prizmasoftware commented 5 months ago

Prerequisites

ImageSharp version

3.1.4

Other ImageSharp packages and versions

2.1.8

Environment (Operating system, version and so on)

Windows 10, Visual Studio 2022, ASP.NET Core Blazor App, C#

.NET Framework version

NET 8

Description

When use code in C#, PDFSharpCore:

ImageSource.ImageSourceImpl = new ImageSharpImageSource(); row.Cells[0].AddImage(ImageSource.FromFile(imagePath));

with ImageSharp 3.1.4 and run with debug, show error:

Microsoft.AspNetCore.Components.Server.Circuits.RemoteRenderer[100] Unhandled exception rendering component: Method not found: 'SixLabors.ImageSharp.Image1<!!0> SixLabors.ImageSharp.Image.Load(System.String, SixLabors.ImageSharp.Formats.IImageFormat ByRef)'. 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, Nullable1 quality) at MigraDocCore.DocumentObjectModel.MigraDoc.DocumentObjectModel.Shapes.ImageSource.FromFile(String path, Nullable`1 quality) at Hydrotek.Reports.RadniNalogReports.RadniNalogReport.TabelaNaslov(Document document) in D:\Moji Dokumenti\Visual_Studio_2022\Projects\WEB\ASP\Blazor\Hydrotek\Reports\RadniNalogReports\RadniNalogReport.cs:line 180 at Hydrotek.Reports.RadniNalogReports.RadniNalogReport.PDF_nalog() in D:\Moji Dokumenti\Visual_Studio_2022\Projects\WEB\ASP\Blazor\Hydrotek\Reports\RadniNalogReports\RadniNalogReport.cs:line 82 at Hydrotek.Pages.RadniNalog.Radni_nalog.PDF_nalog() in D:\Moji Dokumenti\Visual_Studio_2022\Projects\WEB\ASP\Blazor\Hydrotek\Pages\RadniNalog\Radni_nalog.razor:line 531 at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task) at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState) fail: Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost[111]

When downgrade to ver. 2.1.8, work fine.

Steps to Reproduce

Use code

ImageSource.ImageSourceImpl = new ImageSharpImageSource(); row.Cells[0].AddImage(ImageSource.FromFile(imagePath));

with ImageSharp 3.1.4

Images

No response

antonfirsov commented 5 months ago

This is an issue with PdfSharpCore, they need to update their ImageSharp version.

Closing as duplicate of #2441.