Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Mon Jan 06, 2025 1:34 pm

FreeSpire.PDF has a dependency on SkiaSharp (>= 1.68.0). SkiaSharp is currently in version 3.116.1, i.e. two major versions higher. It looks like they removed a method used by FreeSpire.PDF between version 2.x and 3.x which now causes an exception when calling the setter of the PdfTextBoxFieldWidget.Text property:

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.

CaptainVlado
 
Posts: 1
Joined: Mon Jan 06, 2025 1:20 pm

Mon Jan 13, 2025 8:02 am

The same issue occurs when attempting to run the commercial version on Linux using Spire.PDF for .NET Standard. It is not working with SkiaSharp 3.*.

bogdandanielb
 
Posts: 4
Joined: Mon Jan 13, 2025 7:57 am

Mon Jan 13, 2025 9:49 am

Hello,

Thank you for your letter. Yes, Currently the .NETStandard dlls of our product is not compatible with SkiaSharp 3. x. I have recorded this issue with SPIREPDF-7327, we will optimize it in the future. Once it is resolved, we will prioritize updating our commercial version. We only update our free version irregularly.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1371
Joined: Wed Apr 25, 2018 3:20 am

Return to Spire.PDF