Skip to content

Commit 3aa14c0

Browse files
1012499: Addressed review feedbacks
1 parent f8d2d5d commit 3aa14c0

11 files changed

Lines changed: 268 additions & 148 deletions

File tree

Document-Processing-toc.html

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,16 +1012,22 @@
10121012
<li><a href="/document-processing/pdf/pdf-viewer/react/annotation/annotations-api">APIs</a></li>
10131013
</ul>
10141014
</li>
1015-
<li>Redaction and Security
1015+
<li>Redaction
10161016
<ul>
10171017
<li><a href="/document-processing/pdf/pdf-viewer/react/Redaction/overview">Overview</a></li>
10181018
<li><a href="/document-processing/pdf/pdf-viewer/react/Redaction/ui-interaction">UI Interactions</a></li>
10191019
<li><a href="/document-processing/pdf/pdf-viewer/react/Redaction/programmatic-support">Programmatic Support</a></li>
10201020
<li><a href="/document-processing/pdf/pdf-viewer/react/Redaction/toolbar">Toolbar</a></li>
10211021
<li><a href="/document-processing/pdf/pdf-viewer/react/Redaction/mobile-view">Mobile View</a></li>
10221022
<li><a href="/document-processing/pdf/pdf-viewer/react/Redaction/search-redact">Search Text and Redact</a></li>
1023-
<li><a href="/document-processing/pdf/pdf-viewer/react/Redaction/prevent-copy-and-print">Prevent copy/print</a></li>
1024-
<li><a href="/document-processing/pdf/pdf-viewer/react/Redaction/secure-pdf-viewing">Secure PDF viewing in react apps</a></li>
1023+
</ul>
1024+
</li>
1025+
<li>Permissions and Security
1026+
<ul>
1027+
<li><a href="/document-processing/pdf/pdf-viewer/react/security/overview">Overview</a></li>
1028+
<li><a href="/document-processing/pdf/pdf-viewer/react/security/prevent-copy-and-print">Prevent copy/print</a></li>
1029+
<li><a href="/document-processing/pdf/pdf-viewer/react/security/secure-pdf-viewing">Secure PDF viewing in react apps</a></li>
1030+
<li><a href="/document-processing/pdf/pdf-viewer/react/security/restricting-download">Restrict download</a></li>
10251031
</ul>
10261032
</li>
10271033
<li><a href="/document-processing/pdf/pdf-viewer/react/interaction-mode">Interaction Mode</a></li>

Document-Processing/PDF/PDF-Viewer/react/Redaction/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
layout: post
3-
title: Redaction sensitive content in React PDF Viewer | Syncfusion
3+
title: Redact sensitive content in React PDF Viewer | Syncfusion
44
description: Learn how to hide sensitive information with interactive and programmatic redaction using the Syncfusion React PDF Viewer.
55
platform: document-processing
66
control: PDF Viewer

Document-Processing/PDF/PDF-Viewer/react/Redaction/prevent-copy-and-print.md

Lines changed: 0 additions & 108 deletions
This file was deleted.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
layout: post
3+
title: Permissions and security in React PDF Viewer | Syncfusion
4+
description: High-level security and permissions overview and recommended controls for protecting PDF content in EJ2 React PDF Viewer.
5+
platform: document-processing
6+
control: PDF Viewer
7+
documentation: ug
8+
domainurl: ##DomainURL##
9+
---
10+
11+
# Permissions and Security in React PDF Viewer
12+
13+
## Purpose
14+
15+
This page provides a concise security overview and recommended controls when using the EJ2 React PDF Viewer. It summarizes server-side and client-side measures to protect sensitive PDF content while using the viewer in web applications.
16+
17+
## Key recommendations
18+
19+
- **Enforce protections on the server**: Perform encryption, permission flags, redaction, metadata stripping, and form flattening before serving files.
20+
- **Treat viewer UI settings as UX controls**: Disabling print, download, or text-selection in the viewer improves user experience but is not a security boundary unless the underlying PDF enforces permissions.
21+
- **Use short-lived, authenticated access**: Serve PDFs via tokenized endpoints or signed URLs rather than public buckets.
22+
- **Log and monitor access**: Track downloads, apply rate limits, and enforce CORS and auth checks on PDF endpoints.
23+
24+
## Quick actions
25+
26+
- Set [PDF permissions (copy/print)](./prevent-copy-and-print) using server-side PDF libraries before delivery.
27+
- Remove embedded files, scripts, and metadata during preprocessing.
28+
- Flatten form fields and sanitize form data when publishing public documents.
29+
- [Hide or disable viewer UI](./prevent-copy-and-print#3-hidedisable-ui-elements-in-the-viewer) elements for additional UX control.
30+
31+
## Related documents
32+
33+
- [Secure PDf Viewing in React apps](./secure-pdf-viewing)
34+
- [Prevent copy/print](./prevent-copy-and-print)
35+
- [Restricting download](./restricting-download)
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
---
2+
layout: post
3+
title: Prevent Copy or Print in React PDF Viewer | Syncfusion
4+
description: Learn how to prevent printing and copying in the React PDF Viewer using viewer settings or server-side permission flags.
5+
platform: document-processing
6+
control: PDF Viewer
7+
documentation: ug
8+
domainurl: ##DomainURL##
9+
---
10+
11+
# Prevent Copy or Print in React PDF Viewer
12+
13+
## Overview
14+
This guide shows how to prevent users from copying text or printing documents in EJ2 React PDF Viewer.
15+
16+
**Outcome:** You will learn server-side and client-side options to restrict copy/print with a complete React example.
17+
18+
## Steps
19+
20+
### 1. Use a PDF with permissions already set
21+
22+
- Load a PDF that already disallows copy or print functionality itself. The Viewer enforces these permission automatically.
23+
24+
### 2. Pre process restrictions in server-side
25+
26+
- Use Syncfusion PDF Library to set permission flags before sending the file to the client. See the server-side example below. See this [guide](https://help.syncfusion.com/document-processing/pdf/pdf-library/net/working-with-security#change-the-permission-of-the-pdf-document) for detailed explanations
27+
- Disabling print and copy in server-side automatically enforces them in the PDF Viewer.
28+
29+
### 3. Hide/disable UI elements in the viewer
30+
31+
- Print, download and copy options can be disabled or hidden in the viewer regardless of the PDF's permissions.
32+
- Print and download options can be hidden in the viewer's primary toolbar. See [primary toolbar customization](../toolbar-customization/primary-toolbar).
33+
- Copy option in the context menu can be disabled in the PDF Viewer. See [customize context menu](../context-menu/custom-context-menu).
34+
35+
### 4. Disable print programmatically in the viewer
36+
37+
- Set [`enablePrint`](https://ej2.syncfusion.com/react/documentation/api/pdfviewer#enableprint) to `false` to disable the print UI even if the PDF allows printing.
38+
39+
### 5. Disable copy via text-selection UI
40+
41+
- Set [`enableTextSelection`](https://ej2.syncfusion.com/react/documentation/api/pdfviewer#enabletextselection) to `false` to stop text selection and copying through the viewer UI.
42+
43+
**Example:**
44+
45+
The following is a complete React example that demonstrates disabling printing and text selection in the viewer.
46+
47+
{% tabs %}
48+
{% highlight ts tabtitle="App.tsx" %}
49+
{% raw %}
50+
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, BookmarkView, ThumbnailView, Print, TextSelection, TextSearch, Annotation, FormFields, FormDesigner, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';
51+
export default function App() {
52+
return (
53+
<div style={{ height: '100vh' }}>
54+
<PdfViewerComponent
55+
id="pdfViewer"
56+
documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
57+
resourceUrl="https://cdn.syncfusion.com/ej2/32.2.5/dist/ej2-pdfviewer-lib"
58+
enablePrint={false} // disables the print UI
59+
enableTextSelection={false} // disables text selection (prevents copy)
60+
style={{ height: '100%' }}>
61+
<Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, BookmarkView, ThumbnailView, Print, TextSelection, TextSearch, Annotation, FormFields, FormDesigner, PageOrganizer]} />
62+
</PdfViewerComponent>
63+
</div>
64+
);
65+
}
66+
{% endraw %}
67+
{% endhighlight %}
68+
{% endtabs %}
69+
70+
**Expected result**:
71+
- The viewer renders the PDF.
72+
- Print button and print-related UI are hidden/disabled.
73+
- Text selection and copy operations from the viewer are disabled.
74+
75+
## Troubleshooting
76+
77+
- If the Print button still appears:
78+
- Confirm [`enablePrint`](https://ej2.syncfusion.com/react/documentation/api/pdfviewer#enableprint) is set to `false` on `PdfViewerComponent`.
79+
- If the PDF explicitly allows printing, prefer server-side removal of print permission.
80+
- If text can still be copied:
81+
- Confirm [`enableTextSelection`](https://ej2.syncfusion.com/react/documentation/api/pdfviewer#enabletextselection) is set to `false` and your app isn't adding secondary copy handlers.
82+
83+
## Related topics
84+
85+
- [Secure PDF Viewing in React Apps](./secure-pdf-viewing)
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
layout: post
3+
title: Restrict download in React PDF Viewer | Syncfusion
4+
description: Learn how to prevent end users from downloading PDFs displayed by the EJ2 React PDF Viewer using toolbar and events.
5+
platform: document-processing
6+
control: PDF Viewer
7+
documentation: ug
8+
domainurl: ##DomainURL##
9+
---
10+
11+
# Restrict download in React PDF Viewer
12+
13+
## Overview
14+
15+
This guide shows how to prevent end users from downloading PDFs displayed by the EJ2 React PDF Viewer.
16+
17+
**Outcome:** The Download button is removed from the primary toolbar and any download attempt is blocked by the `downloadStart` event handler.
18+
19+
## Prerequisites
20+
- EJ2 React PDF Viewer installed and basic viewer setup completed. See [getting started guide](../getting-started)
21+
22+
## Steps
23+
24+
### 1. Hide the Download button in the primary toolbar
25+
26+
The viewer toolbar items are controlled by `toolbarSettings.toolbarItems`. Omit `DownloadOption` from that array to remove the Download button from the primary toolbar. See [primary toolbar customization](../toolbar-customization/primary-toolbar) for code examples.
27+
28+
### 2. Block download with the `downloadStart` event
29+
30+
The viewer raises the [`downloadStart`](https://ej2.syncfusion.com/react/documentation/api/pdfviewer#downloadstart) event whenever a download is initiated. Add an event handler and set `args.cancel = true` to block the operation regardless of how it was triggered (toolbar, API, or custom UI).
31+
32+
**Example**:
33+
34+
The following is a complete, runnable React example that cancels every download attempt in `onDownloadStart()`.
35+
36+
{% tabs %}
37+
{% highlight ts tabtitle="App.tsx" %}
38+
{% raw %}
39+
import {
40+
PdfViewerComponent, Toolbar, Magnification, Navigation, Annotation, LinkAnnotation,
41+
ThumbnailView, BookmarkView, TextSelection, TextSearch, FormFields, FormDesigner,
42+
PageOrganizer, Inject, Print
43+
} from '@syncfusion/ej2-react-pdfviewer';
44+
45+
export default function App() {
46+
const onDownloadStart = (args: any) => {
47+
// Cancels every download attempt
48+
args.cancel = true;
49+
console.log('Download restricted.');
50+
};
51+
52+
return (
53+
<div style={{ height: '640px' }}>
54+
<PdfViewerComponent
55+
id="pdf-viewer"
56+
documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
57+
resourceUrl="https://cdn.syncfusion.com/ej2/32.2.5/dist/ej2-pdfviewer-lib"
58+
downloadStart={onDownloadStart}
59+
>
60+
<Inject services={[Toolbar, Magnification, Navigation, Annotation, LinkAnnotation, ThumbnailView,
61+
BookmarkView, TextSelection, TextSearch, FormFields, FormDesigner, PageOrganizer, Print]} />
62+
</PdfViewerComponent>
63+
</div>
64+
);
65+
}
66+
{% endraw %}
67+
{% endhighlight %}
68+
{% endtabs %}
69+
70+
**Expected result**:
71+
72+
- Any programmatic or UI-triggered download attempts are canceled by the `downloadStart` handler; no file is downloaded.
73+
74+
## Troubleshooting
75+
76+
- If the Download button is still visible, remove `DownloadOption` from `toolbarSettings.toolbarItems`, and ensure no custom toolbar rendering inserts the Download control.
77+
78+
- If downloads still occur despite the handler, confirm `downloadStart={onDownloadStart}` is present on `PdfViewerComponent` and that the handler sets `args.cancel = true`.
79+
80+
## Related topics
81+
82+
- [Customize primary toolbar](../toolbar-customization/primary-toolbar)
83+
- [`downloadStart` event reference](../events#downloadstart)

Document-Processing/PDF/PDF-Viewer/react/Redaction/secure-pdf-viewing.md renamed to Document-Processing/PDF/PDF-Viewer/react/security/secure-pdf-viewing.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ This section outlines common security controls and how they interact with the vi
2828

2929
- **Permission restrictions**: Set PDF permissions (copy, print) using Syncfusion PDF library. The viewer respects these permissions at display time but cannot enforce protections if the client receives an unprotected full file. See [prevent copy and print permissions](./prevent-copy-and-print)
3030

31-
- **Redaction**: Permanently remove text, images, or regions at the document level on the server before delivering the file. Redaction produces a new PDF with the sensitive content removed. See [redacting sensitive content](./overview)
31+
- **Redaction**: Permanently remove text, images, or regions at the document level on the server before delivering the file. Redaction produces a new PDF with the sensitive content removed. See [redacting sensitive content](../Redaction/overview)
3232

3333
- **Preprocessing**: On the server, remove metadata, embedded files, hidden layers, form field values, JavaScript actions, and flatten form fields. Compress and linearize PDFs if needed. See [preprocessing PDFs](../document-handling/preprocess-pdf)
3434

@@ -48,4 +48,8 @@ This section outlines common security controls and how they interact with the vi
4848
- Strip metadata, embedded files, comments, and JavaScript before serving.
4949
- Flatten form fields and sanitize form data when exporting public PDFs.
5050
- Use short-lived, authenticated URLs or a tokenized download endpoint rather than serving files from a public bucket.
51-
- Log access and apply rate limits and CORS policies on APIs that serve PDFs.
51+
- Log access and apply rate limits and CORS policies on APIs that serve PDFs.
52+
53+
## See also
54+
55+
- [Prevent copy/print](./prevent-copy-and-print)

0 commit comments

Comments
 (0)