PdfSharpCore
PdfSharpCore copied to clipboard
Support ImageSharp 3
In the latest major release of ImageSharp, there are some breaking API changes. This causes compatibility issues if a project uses ImageSharp 3 alongside PdfSharpCore
.
Minimal repro:
Project.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="PdfSharpCore" Version="1.3.47" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.0.0" />
</ItemGroup>
</Project>
Program.cs
using PdfSharpCore.Drawing;
var image = XImage.FromFile("test.png");
Error
System.MissingMethodException: 'Method not found: 'SixLabors.ImageSharp.Image`1<!!0> SixLabors.ImageSharp.Image.Load(System.String, SixLabors.ImageSharp.Formats.IImageFormat ByRef)'.' at PdfSharpCore.Utils.ImageSharpImageSource`1.FromFileImpl(String path, Nullable`1 quality) at MigraDocCore.DocumentObjectModel.MigraDoc.DocumentObjectModel.Shapes.ImageSource.FromFile(String path, Nullable`1 quality) at PdfSharpCore.Drawing.XImage..ctor(String path) at PdfSharpCore.Drawing.XImage.FromFile(String path, PdfReadAccuracy accuracy) at PdfSharpCore.Drawing.XImage.FromFile(String path) at Program.<Main>$(String[] args) in Program.cs:line 2