Search Text feature not working on real device

Hi,
I'm facing issue when using The feature "Search for a text instance". If I'am using the :pdfViewerControl.SearchPrevious() andpdfViewerControl.SearchNext() methods my application is crashing -> "Index was out of the range. Must be non-negative and less than the size of the collection". Instead of showing my custom popup whenisNoMoreOccurrenceFound is set to true, my app is crashing with the previous error code.
Howewer it work fine on emulator : "Galaxy Nexus", but on real device Xiaomi Redmi Note 7 it crash.
private void PdfViewerControl_SearchCompleted(object sender, TextSearchCompletedEventArgs args)
{
isNoMatchFound = args.NoMatchFound;
isNoMoreOccurrenceFound = args.NoMoreOccurrence;
if (isNoMatchFound == true)
{
//Show popup
searchErrorPopupContent.NoOccurenceFound.IsVisible = true;
searchErrorPopupContent.NoMoreOccurenceFound.IsVisible = false;
errorSearchPopup.Show();
isNoMatchFound = false;
}
else
{
if (isNoMoreOccurrenceFound == true)
{
//Show popup
searchErrorPopupContent.NoOccurenceFound.IsVisible = false;
searchErrorPopupContent.NoMoreOccurenceFound.IsVisible = true;
errorSearchPopup.Show();
isNoMoreOccurrenceFound = false;
}
}
}
private void SearchPreviousButton_Clicked(object sender, EventArgs e)
{
pdfViewerControl.SearchPreviousTextCommand.Execute(textSearchEntry.Text);
//pdfViewerControl.SearchPrevious(textSearchEntry.Text);
}
private void SearchNextButton_Clicked(object sender, EventArgs e)
{
pdfViewerControl.SearchNextTextCommand.Execute(textSearchEntry.Text);
//pdfViewerControl.SearchNext(textSearchEntry.Text);
}
Moreover I would ask if using the bindable PDFIUM libray for the PDFVIEWER is still usefull since the last update "Essential studio Vol 1" because When using this cutsom PDF Renderer the loading time looks a bit longer with this library :https://www.syncfusion.com/kb/8861/how-to-use-pdfium-rendering-engine-with-pdfviewer-in-xamarin-android.

6 Replies

AV Ashokkumar Viswanathan Syncfusion Team May 12, 2020 01:27 PM UTC

Hi Rayhane,  
  
We have created a sample to reproduce the issue, “Application crashes with Index was out of the range exception while performing text search” and “PDF document  loading time increased while using PDFium Custom renderer”, but its working as expected.   
  
Please find the sample in the below link,  
  
Kindly share the following details to analyze more on this issue and assist you with the better solution    
·       Simple sample/ modify the above sample to reproduce the issue.  
·       PDF document with which you have reproduced.  
·       Xamarin Forms. 
·       SfPdfViewer version. 
·       Replication procedure to reproduce the issue.  
  
Regards,  
Ashok Kumar Viswanathan. 



RA Rayhane May 18, 2020 09:25 AM UTC

Hi, 

Thank you for the sample. 

The issue “Application crashes with Index was out of the range exception while performing text search” is raise only for one document, for other pdf files it work as expected. I suspect the document to be currupted.

Howewer for some very large pdf files the loading time is smaller when I am not using the pdfium library. 

I am loading PDF file with a list view, each items represent a pdf file, When clicking on an item my app is pushing the pdfviewer page where I load my pdf file. 
With : pdfViewerControl.LoadDocument(fileStream);

I made some tests and it took 8 seconds to load the pdf file without using the pdfium library and 14 seconds to load with the pdfium library. (Tested on Redmi Note 7)

I uploaded the pdf file to show the issue. I don't know if I am allowed to share the document via Google Drive, Rar file is too large > 150 mb. 

https://drive.google.com/file/d/19w1kgnVPWPxzpRLyuVMY2jQMcawiTty6/view?usp=sharing

Tell me if you need more explanation about this issue. 

I am using the latest Version of sfpdfviewer


AV Ashokkumar Viswanathan Syncfusion Team May 18, 2020 12:58 PM UTC

Hi Rayhane,   
Currently we are checking on this and we will update shortly.  

Regards, 
Ashok Kumar Viswanathan. 



AV Ashokkumar Viswanathan Syncfusion Team May 18, 2020 02:14 PM UTC

Hi Rayhane, 
 
We tried to reproduce the issue, “Application crashes with Index was out of the range exception while performing text search” and “PDF document  loading time increased while using PDFium Custom renderer using the PDF document provided in your last update, but we are facing the out of memory exception while loading the provided PDF document. Could you please confirm whether you have reproduced above issues with the provided PDF document? 
 
Please find the sample below in the below link, where we will load the PDF document using list view, 
 
Kindly share the following details to analyze more on this issue and assist you with the better solution     
  1. Simple sample/ modify the above sample to reproduce the issue.  
  2. PDF document with which you have reproduced.  
  3. Xamarin Forms. 
  4. SfPdfViewer version.
  5. Patform
  6. Replication procedure to reproduce the issue. 
 
Regards, 
Ashok Kumar Viswanathan. 



RA Rayhane May 25, 2020 09:45 PM UTC

I tried to load my large pdf file with your sample and it work fine. I also tried to load with the same pdf file but the one that I uploaded and same thing, it work. 


I only have one test device. I will try with some other device to check if the issue is raise with other device.I will come back to you later. 


AV Ashokkumar Viswanathan Syncfusion Team May 26, 2020 10:03 AM UTC

Hi Rayhane, 
 
Thank you for your update. Sure, we will wait to hear from you. 
 
Regards, 
Ashok Kumar Viswanathan. 


Loader.
Up arrow icon