After installation Syncfusion.PDF.OCR.WPF version 25.2.7 the ExtractText function in PDF no longer works

Hello,

I'm running a WPF PDFviewer control in a WinForms application. So far everything has worked perfectl

After installation of  "Syncfusion.PDF.OCR.WPF version: 25.2.7"

I'm getting these errors:

System.MissingMethodException: "Method not found:

"Syncfusion.Pdf.Parsing.PdfLoadedDocument Syncfusion.Windows.PdfViewer.PdfViewerControl.get_LoadedDocument()"."

System.MissingMethodException: "Method not found

"System.String Syncfusion.Windows.PdfViewer.PdfViewerControl.ExtractText(Int32, Syncfusion.Pdf.TextLines ByRef)"."

I've checked all references and versions of the  necessary dlls
The versions are: 
WinForms: 25.2.3
WPF: 25.2.3

I can't find any error and am pretty confused.

Do you have any advice for me?

Thank you in advance for your efforts.

Regards

Helmut


12 Replies

HE Helmut June 5, 2024 06:13 PM UTC

The exact versions of the WnForms and Wpf dlls are : 25.2462.3.0
regards
Helmut



KG Krithika Ganesan Syncfusion Team June 6, 2024 10:23 AM UTC

Hi Helmut,


We are unable to reproduce the reported issue with the provided details. We have attached a sample below in which we attempted to reproduce the issue on our end for your reference. Please modify the provided sample to make the issue reproducible and share it with us. This will help us investigate further.


Regards,

Krithika


Attachment: HostedVB_2aa8683f.zip


HE Helmut June 6, 2024 07:31 PM UTC

Hello Krithika

I thank you for the quick reply.


1.The good news:

Your example works perfectly here in VS 2022.


2. The bad news:

My project doesn't work.


My project works perfectly with the DLLs version: 23.2460.4.0.

Not after the update to version: 25.2462.3.0 or 25.2462.7.0.

Nothing has been changed in the code. The system has been running stably since 2021/22. Syncfusion updates for the DLLs were also installed in the meantime.


I also copied the DLLs from your example project into my project and re-referenced them.

Unfortunately, no success.


The error occurs in these two functions:


Private Sub GoToBookmark()

    Try

        Dim pdfLoadedDocument As PdfLoadedDocument = pdfViewer.pdfViewerControl.LoadedDocument

        Dim bookmarks As PdfBookmarkBase = pdfLoadedDocument.Bookmarks

        Dim firstBookmark As PdfBookmark = bookmarks(0)

        pdfViewer.pdfViewerControl.GoToBookmark(firstBookmark)

    Catch ex As Exception

            MsgBox(ex.ToString)

    End Try

End Function


Public Function TAG_Suchen() As String

     Dim textSearch As New Dictionary(Of Integer, List(Of RectangleF))()

     txtTag.Text = "0"

     If pdfViewer.pdfViewerControl.FindText("§%", textSearch) Then

        Try

             Dim TextLines As TextLines = New TextLines()

             Dim cTest As String = pdfViewer.pdfViewerControl.ExtractText(0, TextLines)

             txtTag.Text = cTest.Substring(cTest.IndexOf("§%") + 2, cTest.IndexOf("$%") - cTest.IndexOf("§%") - 2)

         Catch ex As Exception

             MsgBox(ex.ToString)

        End Try

   End If

 Return txtTag.Text

End Function

This works:  pdfViewer.pdfViewerControl.FindText("§%", textSearch) 

I use the Syncfusion PDF control for a DMS. To ensure that documents are not recorded twice, they are given a tag when they arrive, top left (vertical). When a document is loaded, the tag is searched for (Tag_Search).

Attached are 2 images for better understanding.

I'm at my wits' end at the moment and can only say that it seems to be looking for the "get_LoadedDokument" and "ExtractText functions" in the wrong DLLs, but I can find the functions in the object catalog.


Regards 


Helmut


Attachment: Pics_c8a2b08b.zip


HE Helmut June 7, 2024 08:37 AM UTC

Hello  Krithika

I think I have found the problem. There is something wrong with the references.

I noticed that in my PDF form the import "Imports Syncfusion.PDF" was unused and ineffective.

It was gray, i.e. unused. Even when I commented it out, there were no errors in the code!

So I could easily make declarations for which the NamesSpace Synfusion.Pdf is absolutely necessary.

Example:

Dim txtl as TextLines, gave no error without the imported Namesspace Syncfusion.PDF!


I then have reseted all import/export settings in VS 2022.

Now the declaration works again as it should.

Without the imported NamesSpace Syncfusion.Pdf there are tons of errors in the code.

With imported NamesSpace Syncfusion.Pdf the errors are gone.


My "Tag_Suchen" function now works again. I still have an index problem with the bookmarks, but I think I'll find the problem too.

It's not necessary for you to continue working for now.

It seems that something happened to the references in VS 2022 due to the installation of Syncfusion.OCR.WPF,

which was not immediately apparent.

Thank you for your efforts.

Greetings


Helmut



KG Krithika Ganesan Syncfusion Team June 7, 2024 03:00 PM UTC

Most welcome. We're glad to hear that. Please get back to us if you need any further assistance.



HE Helmut June 11, 2024 07:35 AM UTC

Hello  Krithika,


actually everything worked fine until I added a light/dark switch to the PDF viewer using themes.


I have referenced the following dlls:

Syncfusion.SFSkinManager.Wpf.dll (version: 25.2462.3.0)

Syncfusion.Themens.FluentLight.Wpf.dll (version: 25.2462.3.0)

Syncfusion.Themens.FluentDark.Wpf.dll (version: 25.2462.3.0)


This method is used to toggle:

Private Sub btnSun_Moon_Click(sender As Object, e As EventArgs) Handles btnSun_Moon.Click

  If Me.btnSun_Moon.BackColor = Color.WhiteSmoke Then

      Me.btnSun_Moon.BackColor = Color.FromArgb(40, 40, 40)

      Me.btnSun_Moon.BackgroundImage = My.Resources.Resources.sun_1

      SfSkinManager.SetTheme(pdfViewer, New Theme() With {.ThemeName = "FluentDark"})

  Else

     Me.btnSun_Moon.BackColor = Color.WhiteSmoke

     Me.btnSun_Moon.BackgroundImage = MultiOrg.My.Resources.Resources.moon

     SfSkinManager.SetTheme(pdfViewer, New Theme() With {.ThemeName = "FluentLight"})

  End If

End Sub

Result:

The light/dark switching only affects the scrollbars, the file loading menu and the text box for displaying the page number.

Critical:

PDF documents encrypted with a password can no longer be loaded.

There is an error message on the screen:

Essential PDF-Viewer could not open the PDF Document


Clipboard contains:

Error in loading the PDF document. The complete stack trace is as given below

at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)

at Syncfusion.Windows.PdfViewer.PasswordToolBar.InitializeComponent()

at Syncfusion.Windows.PdfViewer.PasswordToolBar..ctor()

at Syncfusion.Windows.PdfViewer.PdfDocumentView.LoadInternal(String filePath)

at Syncfusion.Windows.PdfViewer.PdfDocumentView.<>c__DisplayClass1c.<Load>b__19()

at Syncfusion.Windows.PdfViewer.UIDispatcher.Execute(Action action)

at Syncfusion.Windows.PdfViewer.PdfDocumentView.Load(String filePath)

at Syncfusion.Windows.PdfViewer.PdfViewerControl.Load(String filePath)


In the attached-file you 'll find some screenshots

If  I remove the references, the system works again, of course without switching between light and dark.

I can't get any further here. Can you help me?


Regards


Helmut


Attachment: Pics_24_06_11_4eda88db.zip


HE Helmut June 12, 2024 09:23 AM UTC


Hello Krithika,
today I've updated the system to version: 26.1462.35.0
Now the toggle between dark/light works,
but the problem of opening a password encrypted PDF remains.
Now I'm getting an error screen (attached).

Regards
Helmut


Attachment: try_to_open_crypted_pdf_b18ec081.zip


KG Krithika Ganesan Syncfusion Team June 12, 2024 11:44 AM UTC

Hi Helmut,

 

We were able to reproduce the reported issue with the provided details on our end, and currently we are analyzing it. We will provide further details on Jun 14th, 2024.

 

Regards,

Krithika



KG Krithika Ganesan Syncfusion Team June 14, 2024 01:16 PM UTC

We have confirmed the issue NullReferenceException occurred while opening protected PDF in Hosted Theme sample” as a defect in our product and we will include the fix into our upcoming weekly NuGet release on June 25th, 2024.

 

Please use the below feedback link to track the status of the reported bug.

https://www.syncfusion.com/feedback/58707/nullreferenceexception-occurred-while-opening-protected-pdf-in-hosted-theme-sample

Note: If you require a patch for the reported issue in any of our Essential Studio Main or SP release version, then kindly let us know the version, so that we can provide a patch in that version based on our SLA policy.

 

Disclaimer: “Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.”



KG Krithika Ganesan Syncfusion Team June 26, 2024 08:08 AM UTC

We have included the fix for NullReferenceException occurred while opening protected PDF in Hosted Theme sample” in our latest weekly release (26.1.39).

Upgrade to the latest version, to get the issue resolved.


Root Cause:

The reported issue occurs when attempting to apply a theme to the password dialog box based on the owner window.


Please use the below link to download our latest NuGet, 

Nuget Link:

https://www.nuget.org/packages/Syncfusion.PdfViewer.WPF/26.1.39

Feedback Link:

https://www.syncfusion.com/feedback/58707/nullreferenceexception-occurred-while-opening-protected-pdf-in-hosted-theme-sample



HE Helmut June 28, 2024 08:38 AM UTC

Hello  Krithika,

after installing your UpDate to version 26.1.3 all works fine!

Thank You, for your excellent service and support!

Regards

Helmut




KG Krithika Ganesan Syncfusion Team July 1, 2024 05:37 AM UTC

We are glad to know that reported issue has been resolved on your end. Please let us know if you need any further assistance.


Loader.
Up arrow icon