From 30c32f41c0e243492af637c679f0814583d6f7df Mon Sep 17 00:00:00 2001 From: SF4524LogeshKumar Date: Mon, 30 Jun 2025 15:16:22 +0530 Subject: [PATCH] 966016: UG Documentation on How to Dynamically enable or disable text selection. --- .../how-to/enable-text-selection.md | 92 ++++++++++++++++++ .../how-to/enable-text-selection.md | 93 +++++++++++++++++++ ej2-asp-core-toc.html | 1 + ej2-asp-mvc-toc.html | 1 + 4 files changed, 187 insertions(+) create mode 100644 ej2-asp-core-mvc/pdfviewer/EJ2_ASP.MVC/how-to/enable-text-selection.md create mode 100644 ej2-asp-core-mvc/pdfviewer/EJ2_ASP.NETCORE/how-to/enable-text-selection.md diff --git a/ej2-asp-core-mvc/pdfviewer/EJ2_ASP.MVC/how-to/enable-text-selection.md b/ej2-asp-core-mvc/pdfviewer/EJ2_ASP.MVC/how-to/enable-text-selection.md new file mode 100644 index 0000000000..f5943caf71 --- /dev/null +++ b/ej2-asp-core-mvc/pdfviewer/EJ2_ASP.MVC/how-to/enable-text-selection.md @@ -0,0 +1,92 @@ +--- +layout: post +title: Enable or Disable Text Selection in EJ2 ASP.NET MVC PDF Viewer | Syncfusion +description: Learn here all about enabling text selection in ASP.NET MVC PDF Viewer component of Syncfusion Essential JS 2 and more. +platform: ej2-asp-core-mvc +control: PDF Viewer +publishingplatform: ##Platform_Name## +documentation: ug +--- + +# Enable or Disable Text Selection in Syncfusion PDF Viewer + +The Syncfusion PDF Viewer provides the `EnableTextSelection` property, which allows you to control whether users can select text within the displayed PDF document. This feature can be toggled programmatically during runtime. + +## Configure Text Selection on Initialization + +You can set the initial text selection behavior when initializing the PDF Viewer control by configuring the `EnableTextSelection` property. By default, text selection is enabled, but you can disable it as shown in the following example: + +{% tabs %} +{% highlight html tabtitle="Standalone" %} + +@using Syncfusion.EJ2 +@{ + ViewBag.Title = "Home Page"; +} + +
+
+ @Html.EJS().PdfViewer("pdfviewer") + .DocumentPath("https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf") + .ResourceUrl("https://cdn.syncfusion.com/ej2/30.1.37/dist/ej2-pdfviewer-lib") + .EnableTextSelection(false) + .Render() +
+
+ +{% endhighlight %} +{% endtabs %} + +## Toggle Text Selection Dynamically + +You can change the text selection behavior at runtime using buttons, menu options, or other UI elements. The following example demonstrates how to toggle text selection with button clicks: + +{% tabs %} +{% highlight html tabtitle="Standalone" %} + +@using Syncfusion.EJ2 +@{ + ViewBag.Title = "Home Page"; +} + +
+
+ + + @Html.EJS().PdfViewer("pdfviewer") + .DocumentPath("https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf") + .ResourceUrl("https://cdn.syncfusion.com/ej2/30.1.37/dist/ej2-pdfviewer-lib") + .EnableTextSelection(false) + .Render() +
+
+ + + +{% endhighlight %} +{% endtabs %} + +## Use Cases and Considerations + +- **Document Protection**: Disabling text selection helps prevent unauthorized copying of sensitive content. +- **Read-only Documents**: In scenarios where documents are meant for viewing only, disabling text selection can provide a cleaner user experience. +- **Interactive Applications**: Toggle text selection based on user roles or document states in complex applications. +- **Controlled Access**: Implement conditional text selection depending on user permissions or document sections. + +## Default Behavior + +By default, text selection is enabled in the PDF Viewer. Set the `EnableTextSelection` property to `false` explicitly if you want to disable this functionality. + +N> When text selection is disabled, users will not be able to select or copy text from the document, which can be useful for protecting document content in certain scenarios. + +[View sample in GitHub](https://github.com/SyncfusionExamples/mvc-pdf-viewer-examples/tree/master/How%20to) \ No newline at end of file diff --git a/ej2-asp-core-mvc/pdfviewer/EJ2_ASP.NETCORE/how-to/enable-text-selection.md b/ej2-asp-core-mvc/pdfviewer/EJ2_ASP.NETCORE/how-to/enable-text-selection.md new file mode 100644 index 0000000000..12b4e9e4f5 --- /dev/null +++ b/ej2-asp-core-mvc/pdfviewer/EJ2_ASP.NETCORE/how-to/enable-text-selection.md @@ -0,0 +1,93 @@ +--- +layout: post +title: Enable or Disable Text Selection in ASP.NET Core PDF Viewer | Syncfusion +description: Learn how to enable text selection in Syncfusion ##Platform_Name## Pdfviewer component of Syncfusion Essential JS 2 and more. +platform: ej2-asp-core-mvc +control: PDF Viewer +documentation: ug +domainurl: ##DomainURL## +--- + +# Enable or Disable Text Selection in Syncfusion PDF Viewer + +The Syncfusion PDF Viewer provides the `enableTextSelection` property, which allows you to control whether users can select text within the displayed PDF document. This feature can be toggled programmatically during runtime. + +## Configure Text Selection on Initialization + +You can set the initial text selection behavior when initializing the PDF Viewer control by configuring the `enableTextSelection` property. By default, text selection is enabled, but you can disable it as shown in the following example: + +{% tabs %} +{% highlight cshtml tabtitle="Standalone" %} + +@page "{handler?}" +@model IndexModel +@{ + ViewData["Title"] = "Home page"; +} + +
+ + +
+ +{% endhighlight %} +{% endtabs %} + +## Toggle Text Selection Dynamically + +You can change the text selection behavior at runtime using buttons, menu options, or other UI elements. The following example demonstrates how to toggle text selection with button clicks: + +{% tabs %} +{% highlight cshtml tabtitle="Standalone" %} + +@page "{handler?}" +@model IndexModel +@{ + ViewData["Title"] = "Home page"; +} + +
+ + + + +
+ + + +{% endhighlight %} +{% endtabs %} + +## Use Cases and Considerations + +- **Document Protection**: Disabling text selection helps prevent unauthorized copying of sensitive content. +- **Read-only Documents**: In scenarios where documents are meant for viewing only, disabling text selection can provide a cleaner user experience. +- **Interactive Applications**: Toggle text selection based on user roles or document states in complex applications. +- **Controlled Access**: Implement conditional text selection depending on user permissions or document sections. + +## Default Behavior + +By default, text selection is enabled in the PDF Viewer. Set the `enableTextSelection` property to `false` explicitly if you want to disable this functionality. + +N> When text selection is disabled, users will not be able to select or copy text from the document, which can be useful for protecting document content in certain scenarios. + +[View sample in GitHub](https://github.com/SyncfusionExamples/asp-core-pdf-viewer-examples/tree/master/How%20to) \ No newline at end of file diff --git a/ej2-asp-core-toc.html b/ej2-asp-core-toc.html index 14d8a8f3be..e05c2a844b 100644 --- a/ej2-asp-core-toc.html +++ b/ej2-asp-core-toc.html @@ -2019,6 +2019,7 @@
  • Extract Text Option
  • Find Text using findTextAsync
  • Extract Text Completed
  • +
  • Dynamically Enable or Disable Text Selection
  • Troubleshooting diff --git a/ej2-asp-mvc-toc.html b/ej2-asp-mvc-toc.html index af4967229c..bd2150c08f 100644 --- a/ej2-asp-mvc-toc.html +++ b/ej2-asp-mvc-toc.html @@ -1978,6 +1978,7 @@
  • Extract Text Option
  • Find Text using findTextAsync
  • Extract Text Completed
  • +
  • Dynamically Enable or Disable Text Selection
  • Troubleshooting