Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ documentation: ug

# Add header values in the JavaScript PDF Viewer

Use the `ajaxHeaders` property inside the PDF Viewers [ajaxRequestSettings](https://ej2.syncfusion.com/javascript/documentation/api/pdfviewer/#ajaxrequestsettings) to send custom HTTP headers with each request made by the viewer.
Use the `ajaxHeaders` property inside the PDF Viewer's [ajaxRequestSettings](https://ej2.syncfusion.com/javascript/documentation/api/pdfviewer#ajaxrequestsettings) to send custom HTTP headers with each request made by the viewer.

Example: Add a custom Authorization header using `ajaxRequestSettings` in an JavaScript component
Example: Add a custom Authorization header using `ajaxRequestSettings` in a JavaScript component

```ts

Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
---
layout: post
title: Configure annotation selector settings in JavaScript PDF Viewer | Syncfusion
title: Configure annotation selector settings in PDF Viewer | Syncfusion
description: Learn how to configure annotation selector settings in the JavaScript PDF Viewer using annotationSelectorSettings and related options.
platform: document-processing
control: PDF Viewer
documentation: ug
domainurl: ##DomainURL##
---

# Configure annotation selector settings
# Configure annotation selector settings in JavaScript

Use the [annotationSelectorSettings](https://ej2.syncfusion.com/documentation/api/pdfviewer/annotationSelectorSettings/) property to customize the appearance and behavior of the annotation selector in the UI.
Use the [annotationSelectorSettings](https://ej2.syncfusion.com/documentation/api/pdfviewer/annotationSelectorSettings) property to customize the appearance and behavior of the annotation selector in the UI.

### AnnotationSelectorSettingsModel

The [AnnotationSelectorSettingsModel](https://ej2.syncfusion.com/documentation/api/accumulation-chart/accumulationAnnotationSettingsModel/) defines settings such as border colors, sizes, and shapes, enabling fine-grained control over how annotations are displayed and interacted with.
The `AnnotationSelectorSettingsModel` defines settings such as border colors, sizes, and shapes, enabling fine-grained control over how annotations are displayed and interacted with.

Steps to configure annotation selector settings

Expand Down Expand Up @@ -42,15 +42,15 @@ Steps to configure annotation selector settings
#### Key properties

- `selectionBorderColor`: Sets the color for the border around selected annotations. Provide a color value (for example, `#4070FF`) to make the selection visible.
- `resizerBorderColor`: Sets the color for the border of the resizer handles.
- `resizerFillColor`: Defines the fill color for the resizer handles.
- `resizerSize`: Determines the size of the resizer handles.
- `resizerBorderColor`: Sets the color for the border of the resize handles.
- `resizerFillColor`: Defines the fill color for the resize handles.
- `resizerSize`: Determines the size of the resize handles.
- `selectionBorderThickness`: Specifies the thickness of the selection border.
- `resizerShape`: Sets the shape of the resizer handles (for example, `Circle` or `Square`).
- `resizerShape`: Sets the shape of the resize handles (for example, `Circle` or `Square`).
- `selectorLineDashArray`: Specifies the dash pattern for the selector line.
- `resizerLocation`: Determines where the resizers appear relative to the annotation (for example, `Corners` or `Edges`).
- `resizerCursorType`: Sets the cursor style when hovering over a resizer.
- `resizerLocation`: Determines where the resize handles appear relative to the annotation (for example, `Corners` or `Edges`).
- `resizerCursorType`: Sets the cursor style when hovering over a resize handle.

N> In the example code block `selectionBorderColor` is left empty for demonstration; supply a color string when configuring the viewer. Also ensure `resizerShape` and `resizerBorderColor` use the correct value types — `resizerShape` expects a shape name (for example, `Circle`) while `resizerBorderColor` expects a color value.
N> In the example code block `selectionBorderColor` is left empty for demonstration; supply a color string when configuring the viewer. Also ensure `resizerShape` and `resizerBorderColor` use the correct value types — `resizerShape` expects a shape name (for example, `Circle`) while `resizerBorderColor` expects a color value format.

[View sample in GitHub](https://github.com/SyncfusionExamples/javascript-pdf-viewer-examples/tree/master/How%20to)
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ var pdfviewer = new ej.pdfviewer.PdfViewer({
Attach an event listener to handle annotation visibility changes and document download.

```js
// Add event listener to the button with ID 'download'
// Add event listener to the button with ID 'save'
document.getElementById('save').addEventListener('click', save);
```

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
layout: post
title: Create PDF Viewer service in JavaScript PDF Viewer | Syncfusion
description: Learn how to create an ASP.NET Core Web API service for the JavaScript PDF Viewer to handle server-side processing for rendering, text extraction, thumbnails, and more.
description: Learn how to create an ASP.NET Core Web API service for JavaScript PDF Viewer to handle server-side processing for rendering, text extraction, and thumbnails.
platform: document-processing
control: PDF Viewer
documentation: ug
Expand All @@ -23,7 +23,7 @@ Follow these steps to create the PDF Viewer service

**Step 1:** In Visual Studio, choose File > New > Project to create a new application.

![Visual Studio: New Project menu](./images/Start.png)
![Visual Studio New Project menu](./images/Start.png)

**Step 2:** Select the ASP.NET Core Web Application template and click **Next**.

Expand Down Expand Up @@ -51,7 +51,7 @@ Install the **Syncfusion.EJ2.PdfViewer.AspNet.Core** package to the application.

**Step 7:** Add the following code to the `PdfViewerController.cs` controller.

```ts
```cs
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Caching.Memory;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
layout: post
title: Create PDF Viewer service using ASP.NET MVC | Syncfusion
description: Learn how to create an ASP.NET MVC Web API service for the JavaScript PDF Viewer to handle server-side processing for rendering and related operations.
title: Create PDF Viewer service using ASP.NET MVC in JS | Syncfusion
description: Learn how to create an ASP.NET MVC Web API service for JavaScript PDF Viewer to handle server-side processing for rendering and related operations.
platform: document-processing
control: PDF Viewer
documentation: ug
domainurl: ##DomainURL##
---
# Create a PDF Viewer service using ASP.NET MVC
# Create a PDF Viewer Web API service using ASP.NET MVC

The JavaScript PDF Viewer requires a server-side service to process PDF documents for rendering. This document explains how to create an ASP.NET MVC Web API service that performs server-side preprocessing and operations used by the client.

Expand Down Expand Up @@ -44,7 +44,7 @@ Open the NuGet Package Manager and install the `Syncfusion.EJ2.PdfViewer.AspNet.

**Step 4:** Add the following code to `PdfViewerController.cs`.

```ts
```cs
using Newtonsoft.Json;
using Syncfusion.EJ2.PdfViewer;
using System;
Expand Down Expand Up @@ -269,7 +269,7 @@ namespace MvcWebService.webapi

**Step 6:** Configure global Web API routing in `Global.asax`:

```
```cs
System.Web.Http.GlobalConfiguration.Configuration.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{action}/{id}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ The following is the output of the custom context menu with customization.
{% endhighlight %}
{% endtabs %}

N> To set up the server-backed PDF Viewer, add the following `serviceUrl` in the `index.ts` file:
N> To set up the server-backed PDF Viewer, add the following `serviceUrl` in the `index.js` file:

`pdfviewer.serviceUrl = 'https://document.syncfusion.com/web-services/pdf-viewer/api/pdfviewer';`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ ej.pdfviewer.PdfViewer.Inject(

// Create viewer instance
var pdfviewer = new ej.pdfviewer.PdfViewer({
documentPath: window.location.origin + '/resouces/pdf-succinctly.pdf',
documentPath: window.location.origin + '/resources/pdf-succinctly.pdf',
resourceUrl: window.location.origin + '/resources/ej2-pdfviewer-lib',
customFonts: [
'simsun.ttc',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ documentation: ug
domainurl: ##DomainURL##
---

# Customize text search color in PDF Viewer
# Customize text search color in JavaScript PDF Viewer

Change the text search and highlight colors using the `textSearchColorSettings` properties. Set `searchColor` for matched text and `searchHighlightColor` for the active result. Both properties accept hexadecimal color values.

Expand All @@ -28,12 +28,12 @@ viewer.textSearchColorSettings.searchHighlightColor = "#0000FF";

The above sets the active result highlight to blue.

- [searchColor](https://ej2.syncfusion.com/documentation/api/pdfviewer/textSearchColorSettings/#searchcolor)
- [searchHighlightColor](https://ej2.syncfusion.com/documentation/api/pdfviewer/textSearchColorSettings/#searchhighlightcolor)
- [searchColor](https://ej2.syncfusion.com/documentation/api/pdfviewer/textSearchColorSettings#searchcolor)
- [searchHighlightColor](https://ej2.syncfusion.com/documentation/api/pdfviewer/textSearchColorSettings#searchhighlightcolor)

Example: buttons to control search flow

```
```html

<button id="search">SearchText</button>
<button id="searchNext">SearchNext</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ documentation: ug
domainurl: ##DomainURL##
---

# Delete an annotation in PDF Viewer
# Delete an annotation in JavaScript PDF Viewer

Use the `deleteAnnotationById()` method to remove a specific annotation from a PDF document by its id.

### Steps to delete a specific annotation

**Step 1:** Follow the getting-started guide to create a simple PDF Viewer sample: [Getting started with JavaScript PDF Viewer](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/javascript-es5/getting-started/).
**Step 1:** Follow the getting-started guide to create a simple PDF Viewer sample: [Getting started with JavaScript PDF Viewer](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/javascript-es5/getting-started).

**Step 2:** Add a control to trigger deletion and use the following example to call `deleteAnnotationById()`.

```
```html
<button id="deleteAnnotationbyId">Delete Annotation By Id</button>
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ domainurl: ##DomainURL##

# Disable the context menu in JavaScript PDF Viewer

Set [ContextMenuOption](https://ej2.syncfusion.com/documentation/api/pdfviewer/#contextmenuoption) to `None` to hide all context menu options. The default value is `RightClick`.
Set [ContextMenuOption](https://ej2.syncfusion.com/documentation/api/pdfviewer#contextmenuoption) to `None` to hide all context menu options. The default value is `RightClick`.

Example: Disable context menu

```
```html

<button id='disable'>Disable ContextMenuOption</button>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Use the `enableTileRendering` property to enable or disable tile rendering. Tile

Example: disable tile rendering with a button

```
```html
<button id="disable">Disable tile rendering</button>

```
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
---
layout: post
title: Display a custom tooltip for annotations in JavaScript PDF Viewer | Syncfusion
title: Display custom annotation tooltip in PDF Viewer | Syncfusion
description: Learn how to display a custom tooltip for annotations in the JavaScript PDF Viewer using the annotationMouseover and annotationMouseLeave events.
platform: document-processing
control: PDF Viewer
documentation: ug
domainurl: ##DomainURL##
---

# Display a custom tooltip for annotations in JavaScript PDF Viewer
# Display a custom tooltip for annotations in PDF Viewer

Display custom tooltips for annotations by handling the [annotationMouseover](https://ej2.syncfusion.com/documentation/api/pdfviewer/#annotationmouseover) and `annotationMouseLeave` events.
Display custom tooltips for annotations by handling the [annotationMouseover](https://ej2.syncfusion.com/documentation/api/pdfviewer#annotationmouseover) and `annotationMouseLeave` events.

- Include the JavaScript PDF Viewer script and the `Annotation` module on the page.
- Include the `ej.popups` module or equivalent tooltip library used in the example.
Expand Down Expand Up @@ -39,4 +39,4 @@ viewer.annotationMouseLeave = function(args) {

```

Sample: [Display a custom tooltip for annotations sample on GitHub/StackBlitz](https://stackblitz.com/edit/ztmvjx-byzwvq?file=index.js)
Sample: [Display a custom tooltip for annotations sample on StackBlitz](https://stackblitz.com/edit/ztmvjx-byzwvq?file=index.js)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
layout: post
title: Download document on window closing in JavaScript PDF Viewer control | Syncfusion
description: Learn how to download a PDF document when the browser window closes or refreshes in the Syncfusion JavaScript PDF Viewer control by handling the onbeforeunload event.
title: Auto-download PDF on window close in PDF Viewer | Syncfusion
description: Learn how to download a PDF document when the browser window closes or refreshes in the JavaScript PDF Viewer control.
platform: document-processing
control: PDF Viewer
documentation: ug
Expand All @@ -10,16 +10,16 @@ domainurl: ##DomainURL##

# Download document on window closing in JavaScript PDF Viewer

The JavaScript PDF Viewer can automatically download the loaded PDF document when the browser window is refreshed or closed by handling the [onbeforeunload](https://developer.mozilla.org/en-US/docs/Web/API/Window/onbeforeunload) event.
The JavaScript PDF Viewer can automatically download the loaded PDF document when the browser window is refreshed or closed by handling the before unload event.

## Prerequisites

- Include the JavaScript PDF Viewer script and initialize the viewer instance on the page.
- Confirm the viewer has finished loading the document before attaching the `onbeforeunload` handler.
- Confirm the viewer has finished loading the document before attaching the event handler.

**Step 1:** Create a working sample by following the getting-started guide: [Getting started with JavaScript PDF Viewer](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/javascript-es5/getting-started/).
**Step 1:** Create a working sample by following the getting-started guide: [Getting started with JavaScript PDF Viewer](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/javascript-es5/getting-started).

**Step 2:** Attach an `onbeforeunload` handler that prompts the user and calls `viewer.download()` to download the document. Note: browser behavior for `onbeforeunload` varies between browsers and some modern browsers restrict prompts; use this pattern judiciously.
**Step 2:** Attach a before unload event handler that prompts the user and calls `viewer.download()` to download the document. Note: browser behavior for this event varies between browsers and some modern browsers restrict prompts; use this pattern judiciously.

```js
// The event triggers when closing or refreshing the window.
Expand All @@ -37,4 +37,4 @@ window.onbeforeunload = function (e) {
};
```

View the sample on GitHub/StackBlitz: [Download PDF before closing or refreshing window sample](https://github.com/SyncfusionExamples/javascript-pdf-viewer-examples/tree/master/Download/Download%20the%20pdf%20document%20before%20closing%20window%20or%20refresh)
View the sample on GitHub: [Download PDF before closing or refreshing window sample](https://github.com/SyncfusionExamples/javascript-pdf-viewer-examples/tree/master/Download/Download%20the%20pdf%20document%20before%20closing%20window%20or%20refresh)
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Export pages as Base64-encoded images using `exportAsImage()` for a single page
**Step 1:** Create a simple PDF Viewer sample by following the getting-started guide: https://help.syncfusion.com/document-processing/pdf/pdf-viewer/javascript-es5/getting-started/

**Step 2:** Use the following code to export a specified page as a Base64-encoded image or a range of pages as Base64-encoded images. Place the button elements in the HTML and attach event handlers after the viewer is initialized.
```
```html

<button id="exportAsImage">ExportAsImage</button>

Expand All @@ -38,7 +38,7 @@ document.getElementById('exportAsImage').addEventListener('click', () => {

Export a specified page as a Base64-encoded image with a custom size:

```
```html

<button id="exportAsImageWithSize">ExportAsImageWithSize</button>

Expand All @@ -59,7 +59,7 @@ document.getElementById('exportAsImageWithSize').addEventListener('click', () =>
```
Export a range of pages as Base64-encoded image strings:

```
```html

<button id="exportAsImages">ExportAsImages</button>

Expand All @@ -80,7 +80,7 @@ document.getElementById('exportAsImages').addEventListener('click', () => {

Export a range of pages as Base64-encoded images with a custom size:

```
```html

<button id="exportAsImagesWithSize">ExportAsImagesWithSize</button>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ control: PDF Viewer
documentation: ug
---

# Extract text option in the JavaScript PDF Viewer
# Extract text option in the JS PDF Viewer

The `extractTextOption` property controls the amount of text and layout information returned by the viewer. Adjusting this value helps balance memory usage and the level of detail required for downstream processing. The viewer exposes four options:

Expand All @@ -32,13 +32,13 @@ ej.pdfviewer.PdfViewer.Inject(ej.pdfviewer.TextSelection, ej.pdfviewer.TextSearc
```

### Description of Each Option
**extractTextOption.TextAndBounds (default):** This option returns both plain text and its positional data (bounds). Use this option when you need to access both the content of the PDF and its layout for further processing or analysis.
**extractTextOption = 'TextAndBounds' (default):** This option returns both plain text and its positional data (bounds). Use this option when you need to access both the content of the PDF and its layout for further processing or analysis.

**extractTextOption.TextOnly:** This option returns only the plain text from the PDF. No positional or layout data is included. Note that when using this option, text search functionality will be disabled. In such cases, it is recommended to use findTextAsync for text searching.
**extractTextOption = 'TextOnly':** This option returns only the plain text from the PDF. No positional or layout data is included. Note that when using this option, text search functionality will be disabled. In such cases, it is recommended to use findTextAsync for text searching.

**extractTextOption.BoundsOnly:** This option returns only the layout information (bounds) of the text, excluding the actual content. It is useful when the focus is on the position of text elements rather than the text itself.
**extractTextOption = 'BoundsOnly':** This option returns only the layout information (bounds) of the text, excluding the actual content. It is useful when the focus is on the position of text elements rather than the text itself.

**extractTextOption.None:** This option does not extract or return any text or layout information. It is used to optimize memory usage when no text extraction is necessary. This setting is only relevant for the `extractTextCompleted` event and cannot be used with the `ExtractText` method.
**extractTextOption = 'None':** This option does not extract or return any text or layout information. It is used to optimize memory usage when no text extraction is necessary. This setting is only relevant for the `extractTextCompleted` event and cannot be used with the `ExtractText` method.

N> Text search: When using the `extractTextOption.TextOnly` or `extractTextOption.None` options, the `findText` method is unavailable. Use the `findTextAsync` method to perform text searches asynchronously.

Expand Down
Loading