Skip to content

Commit 1cddc1b

Browse files
984774: Update the text search event content
1 parent 4a453bc commit 1cddc1b

File tree

2 files changed

+89
-1
lines changed

2 files changed

+89
-1
lines changed

Document-Processing/PDF/PDF-Viewer/blazor/print.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ The SfPdfViewer supports printing the loaded PDF by default. Enable or disable t
113113

114114
## Print Events
115115

116-
The following events are available in the SfPdfViewer component.
116+
The following events are available for print in the SfPdfViewer component.
117117

118118
|Name|Description|
119119
|---|---|

Document-Processing/PDF/PDF-Viewer/blazor/text-search.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,94 @@ Use the [PdfViewerTextSearchColorSettings](https://help.syncfusion.com/cr/blazor
101101

102102
![Blazor SfPdfViewer text search highlight color customization](./images/blazor-pdfviewer-text-search-settings.png)
103103

104+
## Text Search Events
105+
106+
The following events are available for text search in the SfPdfViewer component.
107+
108+
|Name|Description|
109+
|---|---|
110+
|OnTextSearchStart|Triggers when a text search starts.|
111+
|OnTextSearchComplete|Triggers when a text search is completed.|
112+
|OnTextSearchHighlight|Triggers when searched text is highlighted.|
113+
114+
### OnTextSearchStart Event
115+
116+
The [OnTextSearchStart](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerEvents.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerEvents_OnTextSearchStart) event triggers when the text search is started.
117+
118+
#### Event Arguments
119+
120+
See [TextSearchStartEventArgs](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.TextSearchStartEventArgs.html) for details such as matchcase, search text.
121+
122+
The following example illustrates how to handle the TextSearchStart event.
123+
124+
```cshtml
125+
126+
@using Syncfusion.Blazor.SfPdfViewer
127+
<SfPdfViewer2 DocumentPath="@DocumentPath" Height="100%" Width="100%">
128+
<PdfViewerEvents OnTextSearchStart="@TextSearchStart"></PdfViewerEvents>
129+
</SfPdfViewer2>
130+
@code{
131+
private string DocumentPath { get; set; } = "wwwroot/Data/PDF_Succintly.pdf";
132+
public async Task TextSearchStart(TextSearchStartEventArgs args)
133+
{
134+
Console.WriteLine($"Text search word: {args.SearchText}");
135+
}
136+
}
137+
138+
```
139+
140+
### OnTextSearchComplete Event
141+
142+
The [OnTextSearchComplete](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerEvents.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerEvents_OnTextSearchComplete) event triggers when the text search is completed.
143+
144+
#### Event Arguments
145+
146+
[TextSearchCompleteEventArgs](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.TextSearchCompleteEventArgs.html) triggers when the text search is completed.
147+
148+
The following example illustrates how to handle the TextSearchComplete event.
149+
150+
```cshtml
151+
152+
@using Syncfusion.Blazor.SfPdfViewer
153+
<SfPdfViewer2 DocumentPath="@DocumentPath" Height="100%" Width="100%">
154+
<PdfViewerEvents OnTextSearchComplete="@TextSearchComplete"></PdfViewerEvents>
155+
</SfPdfViewer2>
156+
@code{
157+
private string DocumentPath { get; set; } = "wwwroot/Data/PDF_Succintly.pdf";
158+
public async Task TextSearchComplete(TextSearchCompleteEventArgs args)
159+
{
160+
Console.WriteLine("Text search completed");
161+
}
162+
}
163+
164+
```
165+
166+
### OnTextSearchHighlight Event
167+
168+
The [OnTextSearchHighlight](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerEvents.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerEvents_OnTextSearchHighlight) event triggers when the text search text is highlighted.
169+
170+
#### Event Arguments
171+
172+
[TextSearchHighlightEventArgs](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.TextSearchHighlightEventArgs.html) for details such as bounds, pagenumber of the highlighted text.
173+
174+
The following example illustrates how to handle the TextSearchHighlight event.
175+
176+
```cshtml
177+
178+
@using Syncfusion.Blazor.SfPdfViewer
179+
<SfPdfViewer2 DocumentPath="@DocumentPath" Height="100%" Width="100%">
180+
<PdfViewerEvents OnTextSearchHighlight="@TextSearchHighlight"></PdfViewerEvents>
181+
</SfPdfViewer2>
182+
@code{
183+
private string DocumentPath { get; set; } = "wwwroot/Data/PDF_Succintly.pdf";
184+
public async Task TextSearchHighlight(TextSearchHighlightEventArgs args)
185+
{
186+
Console.WriteLine($"Highlighted word pagenumber : {args.PageNumber}");
187+
}
188+
}
189+
190+
```
191+
104192
## See Also
105193

106194
* [Extract and Highlight Text in Blazor PDF Viewer Component](./faqs/how-to-extract-particular-text-and-highlight)

0 commit comments

Comments
 (0)