Skip to content

Commit 4b9bf3d

Browse files
987016: Update the How to section
1 parent cf60139 commit 4b9bf3d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+566
-577
lines changed

Document-Processing/PDF/PDF-Viewer/asp-net-core/how-to/Instantiate-pdfviewer-dynamically.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
---
22
layout: post
3-
title: Instantiate with EJ2 ASP.NET Core PDF Viewer Control | Syncfusion
4-
description: Learn how to dynamically instantiate the PDF Viewer component in Syncfusion ASP.NET Core Pdfviewer component of Syncfusion Essential JS 2 and more.
3+
title: Dynamically instantiate the ASP.NET Core PDF Viewer | Syncfusion
4+
description: Learn how to instantiate the Syncfusion ASP.NET Core PDF Viewer at runtime and load PDF documents on demand.
55
platform: document-processing
6-
control: Instantiate the PDF Viewer component dynamically and load PDF documents
6+
control: PDF Viewer
77
publishingplatform: ASP.NET Core
88
documentation: ug
99
---
1010

11-
# Instantiate the PDF Viewer component dynamically
11+
# Dynamically instantiate the ASP.NET Core PDF Viewer
1212

13-
To instantiate a PDF Viewer component dynamically and load PDF documents in Syncfusion<sup style="font-size:70%">&reg;</sup> PDF Viewer, use the following steps:
13+
Create the Syncfusion<sup style="font-size:70%">&reg;</sup> PDF Viewer instance at runtime when a document request succeeds, instead of rendering it during the initial page load. This approach is useful when the PDF is determined after user input or must be fetched securely from a server endpoint.
1414

15-
In your HTML file, create a div element that will act as a container for the PDF Viewer component, and use the jQuery $.ajax method to make an AJAX request to your server and retrieve a PDF document. Once the document is retrieved, use the PDF Viewer API to load the document into the PDF Viewer component.
15+
Follow these steps to instantiate the component dynamically:
1616

17-
Use the serviceUrl property of the PDF Viewer instance to set the URL of a PDF document you want to load.
17+
- Confirm that the application references the required Syncfusion EJ2 scripts and styles and that the PDF Viewer service endpoint is available in the ASP.NET Core application.
18+
- Add a container element and a button (or another trigger) to the Razor view. The trigger initiates an AJAX request that retrieves the document information.
19+
- Inside the callback, create a new viewer instance, set its [`serviceUrl`](https://help.syncfusion.com/cr/aspnetcore-js2/Syncfusion.EJ2.PdfViewer.PdfViewer.html#Syncfusion_EJ2_PdfViewer_PdfViewer_serviceUrl) to the controller endpoint, assign the document identifier to [`documentPath`](https://help.syncfusion.com/cr/aspnetcore-js2/Syncfusion.EJ2.PdfViewer.PdfViewer.html#Syncfusion_EJ2_PdfViewer_PdfViewer_documentPath), and call `appendTo` to render the control in the container.
1820

1921
```html
2022

@@ -41,6 +43,6 @@ Use the serviceUrl property of the PDF Viewer instance to set the URL of a PDF d
4143

4244
```
4345

44-
In your controller, create an action method that returns a PDF document as an action result.
46+
Ensure that the controller action returns the PDF file or document token expected by the viewer and that the response respects authentication requirements. Dispose of the dynamically created viewer when it is no longer needed to release resources.
4547

46-
[View Sample in GitHub](https://github.com/SyncfusionExamples/asp-core-pdf-viewer-examples/tree/master/Common/Instantiate%20PDF%20Viewer%20dynamically).
48+
[View Sample in GitHub](https://github.com/SyncfusionExamples/asp-core-pdf-viewer-examples/tree/master/Common/Instantiate%20PDF%20Viewer%20dynamically).

Document-Processing/PDF/PDF-Viewer/asp-net-core/how-to/add-annotation-in-text-search.md

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,22 @@
11
---
22
layout: post
3-
title: Add Annotation in Text Search in ASP.NET Core | Syncfusion
4-
description: Learn how to add rectangle annotations using search text bounds in Syncfusion ASP.NET Core Pdfviewer component of Syncfusion Essential JS 2 and more.
3+
title: Add rectangle annotations using text search in ASP.NET Core PDF Viewer | Syncfusion
4+
description: Learn to add rectangle annotations using text search bounds in the Syncfusion ASP.NET Core PDF Viewer component, including initialization and search controls.
55
platform: document-processing
6-
control: Retrieve Annotation Coordinates
6+
control: PDF Viewer
77
publishingplatform: ASP.NET Core
88
documentation: ug
99
---
1010

11-
# Add Rectangle Annotations Using Search Text Bounds in PDF Viewer
11+
# Add rectangle annotations using text search bounds in PDF Viewer
1212

13-
## Overview
13+
A concise guide to adding rectangle annotations at highlighted text search results in the ASP.NET Core PDF Viewer to visually emphasize matches and improve readability.
1414

15-
This guide demonstrates how to add rectangle annotations based on the bounds of highlighted search text in the PDF Viewer. This technique is useful for emphasizing search results with visual markers in annotation-supported applications.
15+
## Steps to add rectangle annotations on search result highlight
1616

17-
## Steps to Add Rectangle Annotations on Search Result Highlight
18-
19-
**Step 1:** Set Up the PDF Viewer in Your ASP.NET Core Project
20-
21-
Follow the steps provided in the [Syncfusion PDF Viewer Getting Started Guide](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/asp-net-core/getting-started) to create a basic PDF Viewer sample.
22-
23-
**Step 2:** Set Up the PdfViewer Component to add rectangle annotations based on the bounds of highlighted search text in the PDF Viewer.
17+
**Step 1:** Follow the steps provided in the [Syncfusion PDF Viewer Getting Started guide](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/asp-net-core/getting-started) to create a simple ASP.NET Core PDF Viewer sample.
2418

19+
**Step 2:** Configure the PDF Viewer to add rectangle annotations based on the bounds of highlighted search text.
2520

2621
```cs
2722

@@ -80,6 +75,10 @@ Follow the steps provided in the [Syncfusion PDF Viewer Getting Started Guide](h
8075

8176
```
8277

83-
By following this guide, you will enable the PDF Viewer to add rectangle annotations at search result locations, thus increasing the visibility of search results in your application.
78+
**Step 3:** Handle the `textSearchHighlight` event to add a rectangle annotation for each highlighted match. The `handleTextSearchHighlight` callback in the script adds the annotation by using the bounds returned from the search event.
79+
80+
**Step 4:** Ensure the Razor markup includes buttons for search, search next, and cancel operations so users can control the text search workflow.
81+
82+
Following these steps enables the PDF Viewer to add rectangle annotations at search result locations, improving the visibility of matches in your ASP.NET Core application.
8483

8584
[View sample in GitHub](https://github.com/SyncfusionExamples/asp-core-pdf-viewer-examples/tree/master/How%20to)

Document-Processing/PDF/PDF-Viewer/asp-net-core/how-to/add-save-button.md

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
---
22
layout: post
3-
title: Add Save Button in Built-In Toolbar | Syncfusion
4-
description: Learn here all about adding save button in built-in Toolbar in Syncfusion ASP.NET Core Pdfviewer component of Syncfusion Essential JS 2 and more.
3+
title: Add Save button to the built-in toolbar in ASP.NET Core PDF Viewer | Syncfusion
4+
description: Learn how to add, show, hide, enable, and disable a custom Save button in the built-in toolbar of the Syncfusion ASP.NET Core PDF Viewer component.
55
platform: document-processing
66
control: PDF Viewer
77
publishingplatform: ASP.NET Core
88
documentation: ug
99
---
1010

11-
# Add Save Button in Built-In toolbar
11+
# Add a Save button to the built-in toolbar
1212

13-
PDF Viewer allows you to customize(add, show, hide, enable, and disable) existing items in a toolbar.
13+
PDF Viewer supports customizing toolbar items, including adding, showing, hiding, enabling, and disabling items.
1414

15-
* Save button - New `save` button-item can be defined by **CustomToolbarItemModel** and with existing items in [**ToolbarSettings**](https://help.syncfusion.com/cr/aspnetcore-js2/Syncfusion.EJ2.PdfViewer.PdfViewerToolbarSettings.html) property. Save button-item click action can be defined in `toolbarclick`.
15+
- Save button: Define the `Save` button using **CustomToolbarItemModel** and include it alongside existing items via [**ToolbarSettings**](https://help.syncfusion.com/cr/aspnetcore-js2/Syncfusion.EJ2.PdfViewer.PdfViewerToolbarSettings.html). Handle clicks in the toolbarClick event.
1616

17-
* Show, Hide - `Save` button-item can be shown or hidden using the [`ToolbarSettings`](https://help.syncfusion.com/cr/aspnetcore-js2/Syncfusion.EJ2.PdfViewer.PdfViewerToolbarSettings.html) property. Pre-defined toolbar items are available with [`ToolbarItem`](https://help.syncfusion.com/cr/aspnetcore-js2/Syncfusion.EJ2.PdfViewer.PdfViewerToolbarSettings.html#Syncfusion_EJ2_PdfViewer_PdfViewerToolbarSettings_ToolbarItems).
17+
- Show or hide: Show or hide the `Save` button using [**ToolbarSettings**](https://help.syncfusion.com/cr/aspnetcore-js2/Syncfusion.EJ2.PdfViewer.PdfViewerToolbarSettings.html). Predefined toolbar items are listed under [`ToolbarItem`](https://help.syncfusion.com/cr/aspnetcore-js2/Syncfusion.EJ2.PdfViewer.PdfViewerToolbarSettings.html#Syncfusion_EJ2_PdfViewer_PdfViewerToolbarSettings_ToolbarItems).
1818

19-
* Enable, Disable - `Save` button-item can be enabled or disable using `enabletoolbaritem`.
19+
- Enable or disable: Enable or disable the `Save` button using `enableToolbarItem`.
2020

2121
{% tabs %}
2222
{% highlight html tabtitle="Standalone" %}
@@ -105,34 +105,33 @@ PDF Viewer allows you to customize(add, show, hide, enable, and disable) existin
105105
{% endhighlight %}
106106
{% endtabs %}
107107

108-
N> Default value of toolbar items is ['OpenOption', 'PageNavigationTool','MagnificationTool', 'PanTool', 'SelectionTool', 'SearchOption', 'PrintOption', 'DownloadOption','UndoRedoTool', 'AnnotationEditTool', 'FormDesignerEditTool', 'CommentTool', 'SubmitForm']
108+
N> Default toolbar items: ['OpenOption', 'PageNavigationTool','MagnificationTool', 'PanTool', 'SelectionTool', 'SearchOption', 'PrintOption', 'DownloadOption','UndoRedoTool', 'AnnotationEditTool', 'FormDesignerEditTool', 'CommentTool', 'SubmitForm']
109109

110-
### Align Property
110+
### Align property
111111

112-
The align property is used to specify the alignment of a `save` button-item within the toolbar.
112+
Specifies the alignment of the `Save` button within the toolbar.
113113

114-
`Left`: Aligns the item to the left side of the toolbar.
115-
`Right`: Aligns the item to the right side of the toolbar.
114+
- `Left`: Aligns the item to the left side of the toolbar.
115+
- `Right`: Aligns the item to the right side of the toolbar.
116116

117-
### Tooltip Property
117+
### Tooltip property
118118

119-
The tooltip property is used to set the tooltip text for a `save` button-item. Tooltip provides additional information when a user hovers over the item.
119+
Sets the tooltip text for the Save button. The tooltip provides additional information on hover.
120120

121-
### CssClass Property
121+
### CssClass property
122122

123-
The cssClass property is used to apply custom CSS classes to a `save` button-item. It allows custom styling of the save button-item.
123+
Applies custom CSS classes to the Save button for styling.
124124

125-
### Prefix Property
125+
### Prefix property
126126

127-
The prefix property is used to set the CSS class or icon that should be added as a prefix to the existing content of the toolbar item.
127+
Sets the CSS class or icon to add as a prefix to the Save button content.
128128

129-
### ID Property
129+
### ID property
130130

131-
The id property within a CustomToolbarItemModel is a compulsory attribute that plays a vital role in toolbar customization. It serves as a unique identifier for each toolbar item, facilitating distinct references and interactions.
131+
The id property within a CustomToolbarItemModel is required and uniquely identifies each toolbar item for configuration and interaction.
132132

133-
When defining or customizing toolbar items, it is mandatory to assign a specific and descriptive id to each item.
134-
These properties are commonly used when defining custom toolbar items with the `CustomToolbarItemModel`` in the context of Syncfusion<sup style="font-size:70%">&reg;</sup> PDF Viewer. When configuring the toolbar using the `ToolbarSettings`` property, you can include these properties to customize the appearance and behavior of each toolbar item.
133+
When defining or customizing toolbar items, assign a specific, descriptive id to each item. These properties are commonly used when defining custom toolbar items with `CustomToolbarItemModel` in the context of the Syncfusion<sup style="font-size:70%">&reg;</sup> PDF Viewer. When configuring the toolbar using the `ToolbarSettings` property, include these properties to customize appearance and behavior.
135134

136-
N> When customizing `save` button-item, you have the flexibility to include either icons or text based on your design preference.
135+
N> When customizing the Save button, icons or text can be used based on design preference.
137136

138137
[View sample in GitHub](https://github.com/SyncfusionExamples/asp-core-pdf-viewer-examples/tree/master/How%20to)

Document-Processing/PDF/PDF-Viewer/asp-net-core/how-to/authorization-token.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@ layout: post
33
title: Authorization Token in ASP.NET Core Pdfviewer Component
44
description: Learn here all about Authorization Token in Syncfusion ASP.NET Core Pdfviewer component of Syncfusion Essential JS 2 and more.
55
platform: document-processing
6-
control: Authorization Token
6+
control: PDF Viewer
77
publishingplatform: ASP.NET Core
88
documentation: ug
99
---
1010

1111
# Include the Authorization token
1212

13-
The PDF Viewer library allows you to include the authorization token in the PDF viewer AJAX request using the properties of the ajaxRequest header available in `AjaxRequestSettings`, and it will be included in every AJAX request send from PDF Viewer.
13+
The PDF Viewer component enables adding authorization tokens to each AJAX request through the `ajaxHeaders` collection in `AjaxRequestSettings`, ensuring the header is appended to every call initiated by the viewer.
1414

15-
The following steps are used to include the authorization token to the PDF viewer control.
15+
Use the following steps to configure the authorization token for the PDF Viewer control.
1616

17-
**Step 1:** Follow the steps provided in the [link](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/asp-net-core/getting-started) to create simple PDF Viewer sample in React.
17+
**Step 1:** Follow the steps in the [Getting Started with ASP.NET Core PDF Viewer guide](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/asp-net-core/getting-started) to configure a basic ASP.NET Core project with the PDF Viewer component.
1818

19-
**Step 2:** Add the following code snippet to include the authorization token.
19+
**Step 2:** Add the following script after the PDF Viewer instance is rendered (for example, in the Razor view or layout file) to include the authorization token in subsequent requests.
2020

2121
```html
2222
<script>
@@ -37,4 +37,4 @@ The following steps are used to include the authorization token to the PDF viewe
3737
</script>
3838
```
3939

40-
[View sample in GitHub](https://github.com/SyncfusionExamples/asp-core-pdf-viewer-examples/tree/master/How%20to/Include%20the%20Authorization%20token)
40+
[View sample in GitHub](https://github.com/SyncfusionExamples/asp-core-pdf-viewer-examples/tree/master/How%20to/Include%20the%20Authorization%20token)

Document-Processing/PDF/PDF-Viewer/asp-net-core/how-to/capture-page-number.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
---
22
layout: post
3-
title: Capture Page Number in ASP.NET Core Pdfviewer Component
4-
description: Learn here all about Capture Page Number in Syncfusion ASP.NET Core Pdfviewer component of Syncfusion Essential JS 2 and more.
3+
title: Capture the current page number in ASP.NET Core PDF Viewer
4+
description: Discover how to read the current page number in the Syncfusion ASP.NET Core PDF Viewer using built-in properties.
55
platform: document-processing
6-
control: Capture Page Number
6+
control: PDF Viewer
77
publishingplatform: ASP.NET Core
88
documentation: ug
99
---
1010

1111
# Capture the current page number being viewed
1212

13-
The PDF Viewer server library allows you to capture the page number that is currently being viewed in the load PDF document. Use the [**currentPageNumber**](https://ej2.syncfusion.com/javascript/documentation/api/pdfviewer/#currentpagenumber) property to get the page number which is currently in view.
13+
The PDF Viewer server library allows you to capture the page number that is currently visible when a PDF document is loaded. Use the [**currentPageNumber**](https://ej2.syncfusion.com/javascript/documentation/api/pdfviewer/#currentpagenumber) property to obtain the page that is in view.
1414

15-
The following steps are used to capture the current page number.
15+
The following steps outline how to capture the current page number.
1616

17-
**Step 1:** Follow the steps provided in the [link](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/asp-net-core/getting-started) to create a simple PDF Viewer sample.
17+
**Step 1:** Follow the steps in the [Getting Started with ASP.NET Core PDF Viewer guide](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/asp-net-core/getting-started) to configure a simple PDF Viewer sample, including the required script and style references.
1818

19-
**Step 2:** Use the following code snippet to Capture the current page number being viewed.
19+
**Step 2:** Place the following markup and script in the Razor view after the PDF Viewer component renders to capture the current page number on demand.
2020

2121

2222
{% tabs %}
@@ -63,4 +63,6 @@ The following steps are used to capture the current page number.
6363
{% endhighlight %}
6464
{% endtabs %}
6565

66-
[View sample in GitHub](https://github.com/SyncfusionExamples/asp-core-pdf-viewer-examples/tree/master/How%20to/Capture%20the%20current%20page%20number)
66+
The script retrieves the PDF Viewer instance from the page, reads the `currentPageNumber` property, and surfaces the value in an alert dialog when the button is clicked.
67+
68+
[View sample in GitHub](https://github.com/SyncfusionExamples/asp-core-pdf-viewer-examples/tree/master/How%20to/Capture%20the%20current%20page%20number)

0 commit comments

Comments
 (0)