System.MissingMethodException: Method not found: 'SkiaSharp.SKMatrix SkiaSharp.SKMatrix.MakeTranslation(Single, Single)'.
at spr?.?(Single A_0, Single A_1, spr? A_2)
at spr?.?(Single A_0, Single A_1)
at spr?.?(Single A_0, Single A_1)
at Spire.Pdf.Graphics.PdfCanvas.?(Single A_0, Single A_1, spr? A_2)
at Spire.Pdf.Graphics.PdfCanvas.TranslateTransform(Single offsetX, Single offsetY)
at Spire.Pdf.Graphics.PdfCanvas.?()
at Spire.Pdf.Widget.PdfTextBoxFieldWidget.?(spr? A_0)
at Spire.Pdf.Widget.PdfTextBoxFieldWidget.?(String A_0)
at Spire.Pdf.Widget.PdfTextBoxFieldWidget.set_Text(String value)
To reproduce the issue, the following code can be used:
- Code: Select all
try
{
using var document = new PdfDocument();
document.LoadFromFile("Sample.pdf");
if (document.Form is PdfFormWidget formWidget)
{
foreach (var field in formWidget.FieldsWidget.List)
{
if (field is PdfTextBoxFieldWidget textBoxField)
{
textBoxField.Text = "Test";
}
}
}
document.SaveToFile("Sample-filled.pdf");
Console.WriteLine("Done");
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
If the project references directly or indirectly SkiaSharp 3.116.0 or later, the above mentioned exception is thrown. If the reference is to SkiaSharp 2.88.9 or earlier, everything works fine.
Note: In my actual case SkiaSharp is reference transiently from another nuget package that uses it and requires the newest version.
Attached are two versions of a sample project:
Failing.zip: contains the following line in the project file:
<PackageReference Include="SkiaSharp" Version="3.116.1" />
Succeeding.zip: contains the following line in the project file:
<PackageReference Include="SkiaSharp" Version="2.88.9" />
The rest of the code is the same.
Note that the paid version of Spire.PDF does not depend on SkiaSharp and works without any issue in the most recent version.