TypeLoadException (System.Windows.Rect) when creating new PdfFormatProvider

1 Answer 407 Views
PdfProcessing
Bram
Top achievements
Rank 1
Iron
Iron
Bram asked on 03 Feb 2023, 02:08 PM | edited on 03 Feb 2023, 02:18 PM

I have installed the necessary nuget packages for pdf processing in an exisiting Asp.Net Core (.Net 7.0) Blazor project.

- Telerik.Windows.Documents.Core 2023.1.104
- Telerik.Windows.Documents.Fixed 2023.1.104
- Telerik.Windows.Zip 2023.1.104

In the OnClick handler of a button, the first line of code throws an exception:                   

 

       public void EditPdfDocument(MouseEventArgs args)
        {
            var provider = new PdfFormatProvider(); // exception is thrown here
            var doc = provider.Import(File.ReadAllBytes(@"path-to-file.pdf"));

            // ...
        }

Exception details:

System.TypeLoadException
  HResult=0x80131522
  Message=Could not load type 'System.Windows.Rect' from assembly 'WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
  Source=Telerik.Windows.Documents.Fixed
  StackTrace:
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider..ctor()
  ...


1 Answer, 1 is accepted

Sort by
1
Accepted
Dimitar
Telerik team
answered on 06 Feb 2023, 10:26 AM

Hello Bram,

The following article shows what is causing this: TypeLoadException is thrown trying to run .NET Core project with Telerik Document Processing - Telerik Document Processing.

Let me know if I can assist you further.

Regards,
Dimitar
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
PdfProcessing
Asked by
Bram
Top achievements
Rank 1
Iron
Iron
Answers by
Dimitar
Telerik team
Share this question
or