Spire.PDFViewer is a powerful PDF Viewer component for .NET. It allows developers to load PDF document from stream, file and byte array.

Thu Mar 14, 2019 5:14 pm

Hi, I have a problem because if I use SearchText function, the current page works fine but I don't understand why not works in all other pages.
I found a valid algorythm in older versions of Spire.PDF but this isn't compatible with the current one:
PdfTextFind[] result = null;

foreach (PdfPageBase page in pdf.Pages)
{
result = page.FindText([Searched Text]).Finds;
foreach (PdfTextFind find in result)
{
find.ApplyHighLight();
}
}

Anyone knows a solution?

Greatings
Damiano

damiano.viezzi@olipress.it
 
Posts: 9
Joined: Tue Mar 05, 2019 8:12 am

Fri Mar 15, 2019 6:31 am

Hello Damiano,

Thanks for your inquiry.
I did an initial test with the latest Spire.PDFViewer Pack(Hotfix) Version:4.2.2, but didn't encounter the issue you mentioned. Below is my testing code. And I tested the code you provided with the latest Spire.PDF Pack(Hot Fix) Version:5.3.2, also didn't find any issue. If you were using old versions, I suggest that you try the latest versions. If the issue still happens, please provide your input PDF file for further investigation. You could send it to usvia email (support@e-iceblue.com).
Code: Select all
this.pdfDocumentViewer1.SearchText(SerchedText, Color.FromArgb(0x60, Color.Red), true);

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1182
Joined: Tue Sep 27, 2016 1:06 am

Fri Mar 15, 2019 9:13 am

Unfortunately nothing happens using the versions you mentioning!
I give you another info: the first page not works; the second one works.

:( :( :( :?:

damiano.viezzi@olipress.it
 
Posts: 9
Joined: Tue Mar 05, 2019 8:12 am

Fri Mar 15, 2019 9:25 am

Hi,

Thanks for your reply.
We need your input PDF file to do investigation accurately, please also tell us the "Searched text" in your code. Don't worry, we promise to keep your document confidential and we will not use it for any other purpose. Besides, you could also remove the security data of your document as long as your modified file could reproduce your issue. Thanks in advance.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1182
Joined: Tue Sep 27, 2016 1:06 am

Fri Mar 15, 2019 12:01 pm

This is my code in VB.Net (anyway is the same as your example):

PDFDocumentViewer.SearchText(TxtCercaPDF.Text, Color.FromArgb(80, Color.Yellow), True)

I try this but not works:
For Page As Integer = 1 To PDFDocumentViewer.PageCount
If Page <> PDFDocumentViewer.CurrentPageNumber Then PDFDocumentViewer.GoToPage(Page)
PDFDocumentViewer.SearchText(TxtCercaPDF.Text, Color.FromArgb(80, Color.Yellow), True)
Next Page

Thanks in advance

damiano.viezzi@olipress.it
 
Posts: 9
Joined: Tue Mar 05, 2019 8:12 am

Mon Mar 18, 2019 3:29 am

Hi,

Thanks for your further information and sorry for late reply as weekend.
Unfortunately, I still can't reproduce your issue. All texts in PDF pages were searched and highlighted successfully on my side. Here I attached my testing application for your reference. Please directly run it and tell us your result. If the issue only happens with your input PDF, I'm afraid we need your input PDF file and the text (TxtCercaPDF.Text) you searched. Look forward to your reply.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1182
Joined: Tue Sep 27, 2016 1:06 am

Mon Mar 18, 2019 8:28 am

Unfortunately all of my tests uses a MemoryStream to show PDF moreover I use Free Spire.PDFViewer but I don't know if this can be the cause of my problem.

If this can help ...

Greetings,
Damiano

damiano.viezzi@olipress.it
 
Posts: 9
Joined: Tue Mar 05, 2019 8:12 am

Mon Mar 18, 2019 9:25 am

Hello,

Thanks for your feedback.
I tested with the free Spire.PDFViewer(Free Spire.PDFViewer for .NET Version:4.1), but still didn't find any issue. Also loading your file from stream has no impact. Did you run my testing application? Did it work well? Please confirm if the issue only happens with your input PDF file. Please provide your test application including your input PDF file. So that we can locate your issue quickly and help you out. Thanks in advance.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1182
Joined: Tue Sep 27, 2016 1:06 am

Mon Mar 18, 2019 10:11 am

Hi, I confirm that your code works perfectly; I tried to change dlls of Spire.PDFViewer to simulate my case but anyway works perfectly. :roll:
I'm happy for this but I don't understand what happens in my project!!!

In the afternoon (for me) I will synthetize my project in a form and I will sent you.

Thank you for your interest
Regards

damiano.viezzi@olipress.it
 
Posts: 9
Joined: Tue Mar 05, 2019 8:12 am

Mon Mar 18, 2019 10:45 am

Hi,

Okay, I am waiting for your testing application. You could send it to us via email (support@e-iceblue.com).

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1182
Joined: Tue Sep 27, 2016 1:06 am

Return to Spire.PDFViewer