Skip to content

Working with Text Search in .NET MAUI PDF Viewer #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 18, 2025
Merged

Conversation

deepika134
Copy link
Collaborator

An example added for Working with Text Search in .NET MAUI PDF Viewer

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@@ -0,0 +1,24 @@

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
  1. The sample is in TextSearch folder which is fine.
  2. We may need to add a folder inside (with folder name based on use case) and add the sample. because in future we may add text search samples inside this folder.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed


// Load the PDF document from embedded resources.
Stream? stream = typeof(MainPage).GetTypeInfo().Assembly.GetManifestResourceStream("TextSearch.Assets.PDF_Succinctly.pdf");
PdfViewer.LoadDocument(stream!);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Here force not null operator is used. Please check with null as below

if (stream != null)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed

}

// Searches for the specified text asynchronously and stores the result.
async void SearchText(string text)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// Searches for the specified text asynchronously and stores the result.
async void SearchText(string text)
{
SearchResult = await PdfViewer.SearchTextAsync(text);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. We may need to show the search progress to the users. Did we handle it? https://help.syncfusion.com/maui/pdf-viewer/text-search#text-search-progress
  2. We may need to show the search completion to the users. Did we use any "Search completed', "no matches found" kind of things?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, the application does not handle search progress or search completion notifications. The text search is performed asynchronously using SearchTextAsync().

@Deepak1799 Deepak1799 merged commit 37acee0 into master Jun 18, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants