You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Document-Processing/PDF/PDF-Viewer/blazor/text-selection/enable-text-selection.md
+2-10Lines changed: 2 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,11 +12,7 @@ domainurl: ##DomainURL##
12
12
13
13
This guide explains how to enable or disable text selection in the Syncfusion Blazor PDF Viewer using both initialization-time settings and runtime toggling.
14
14
15
-
**Outcome:** By the end of this guide, you will be able to control whether users can select text in the PDF Viewer.
16
-
17
-
## Steps to toggle text selection
18
-
19
-
### 1. Disable text selection at initialization
15
+
### Disable text selection at initialization
20
16
21
17
Use the [EnableTextSelection](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerBase.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerBase_EnableTextSelection) property during initialization to disable or enable text selection. The following example disables the text selection during initialization.
22
18
@@ -35,7 +31,7 @@ Use the [EnableTextSelection](https://help.syncfusion.com/cr/blazor/Syncfusion.B
35
31
{% endhighlight %}
36
32
{% endtabs %}
37
33
38
-
### 2. Toggle text selection at runtime
34
+
### Toggle text selection at runtime
39
35
40
36
The [EnableTextSelection](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerBase.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerBase_EnableTextSelection) property can be toggled at runtime using buttons to enable or disable text selection dynamically. The following example demonstrates how to toggle text selection using button click events while also updating the [InteractionMode](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerBase.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerBase_InteractionMode) and reloading the document.
41
37
@@ -84,10 +80,6 @@ The [EnableTextSelection](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazo
84
80
85
81
N> Text selection is enabled by default. Set `EnableTextSelection` to `false` to disable it.
86
82
87
-
## Troubleshooting
88
-
89
-
If text selection remains active, ensure that the [EnableTextSelection](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerBase.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerBase_EnableTextSelection) property is set to `false`.
90
-
91
83
## See also
92
84
93
85
-[Text Selection API reference](./text-selection-api-events)
Copy file name to clipboardExpand all lines: Document-Processing/PDF/PDF-Viewer/blazor/text-selection/overview.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,11 +28,11 @@ The feature behaves consistently across single-page and multi-page documents.
28
28
29
29
## Copying text
30
30
31
-
Copying is available through several user interaction methods.
31
+
You can copy selected text using the following options:
32
32
33
33
### Using the context menu
34
34
35
-
When text is selected, the built‑in context menu shows a Copy option. Selecting this option copies the highlighted text to the clipboard. See the [context menu](../context-menu/builtin-context-menu#text-menu-items) documentation for further explanation.
35
+
When text is selected, the built‑in context menu shows a Copy option. Selecting this option copies the highlighted text to the clipboard. See the [context menu](../context-menu) documentation for further explanation.
Copy file name to clipboardExpand all lines: Document-Processing/PDF/PDF-Viewer/blazor/text-selection/text-selection-api-events.md
+37-53Lines changed: 37 additions & 53 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,20 +16,9 @@ This document provides the reference details for text selection APIs and events
16
16
17
17
### SelectTextRegionAsync
18
18
19
-
Programmatically selects text within a specified page and bounds.
19
+
The [SelectTextRegionAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerBase.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerBase_SelectTextRegionAsync_System_Int32_System_Collections_Generic_List_Syncfusion_Blazor_SfPdfViewer_Bound__) method programmatically selects text within a specified page and bounds. Use to highlight specific text regions based on user interactions, search results, or application logic.
Clears all text selection in the PDF document. Removes any highlighted or selected text regions.
70
-
71
-
**Method signature:**
72
-
73
-
```cshtml
74
-
ClearTextSelectionAsync(): Task
75
-
```
57
+
The [ClearTextSelectionAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerBase.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerBase_ClearTextSelectionAsync) event clears all text selection in the PDF document. Removes any highlighted or selected text regions and resets the selection state. Use to reset the UI when users start a new operation or when clearing filtered results.
76
58
77
-
**Example:**
59
+
The following example illustrates how to handle the ClearTextSelectionAsync Method.
The [OnTextSlectionStart](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerEvents.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerEvents_OnTextSelectionStart) event is triggered when the user begins selecting text. Use to perform actions when text selection starts, such as logging, updating UI elements, or starting data collection.
// PageNumber - The page where the selection started (1‑based indexing)
121
111
int pageNumber = args.PageNumber;
122
-
Console.WriteLine(pageNumber);
112
+
Console.WriteLine($"Text selection started on page: {pageNumber}");
123
113
}
124
114
}
125
115
{% endhighlight %}
126
116
{% endtabs %}
127
117
128
-
**Arguments include:**
118
+
### OnTextSelectionEnd
129
119
130
-
-`PageNumber` - The page where the selection started (1‑based indexing).
120
+
The [OnTextSlectionEnd](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerEvents.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerEvents_OnTextSelectionEnd) event is triggered when the selection operation completes. Use to capture and process selected text, update UI elements, or perform operations based on the selection bounds and content.
// PageNumber - Page where the selection ended (1‑based indexing)
147
-
int pageNumber = args.PageNumber;
148
-
Console.WriteLine(pageNumber);
149
-
// TextContent - The full text extracted from the selection range
150
143
string textContent = args.TextContent;
151
-
Console.WriteLine(textContent);
152
-
// TextBounds - Array of bounding rectangles that define the geometric region of the selected text
153
144
List<TextBound> textBounds = args.TextBounds;
154
-
Console.WriteLine(textBounds);
155
145
}
156
146
}
157
147
{% endhighlight %}
158
148
{% endtabs %}
159
149
160
-
**Arguments include:**
161
-
162
-
-`PageNumber` - Page where the selection ended (1‑based indexing).
163
-
-`TextContent` - The full text extracted from the selection range.
164
-
-`TextBounds` - Array of bounding rectangles that define the geometric region of the selected text. Useful for custom UI overlays or programmatic re-selection.
0 commit comments