|
| 1 | +--- |
| 2 | +layout: post |
| 3 | +title: Secure PDF Viewing Patterns in React PDF Viewer |
| 4 | +description: Learn common security patterns for controlling access, restricting actions, and securely handling sensitive PDF content using the Syncfusion React PDF Viewer. |
| 5 | +platform: document-processing |
| 6 | +control: PDF Viewer |
| 7 | +documentation: ug |
| 8 | +domainurl: ##DomainURL## |
| 9 | +--- |
| 10 | + |
| 11 | +# Secure PDF Viewing Patterns |
| 12 | + |
| 13 | +## Overview |
| 14 | +Applications that display sensitive documents often require strict security controls. |
| 15 | +The Syncfusion React PDF Viewer includes built‑in capabilities to protect PDFs, restrict user actions, honor document permissions, and support secure collaboration workflows. |
| 16 | +This section outlines common secure‑viewing patterns and when to apply them. |
| 17 | + |
| 18 | +## Restrict PDF Access |
| 19 | +Security begins with controlling **who can load** the PDF file and **how** it is delivered. |
| 20 | + |
| 21 | +### Use Server‑Backed Viewer for Protected Environments |
| 22 | +The **Server‑Backed Viewer** renders documents on a backend Web API (`serviceUrl`). |
| 23 | +The raw PDF **never reaches the browser**, making this ideal for confidential, regulated, or enterprise deployments. |
| 24 | + |
| 25 | + |
| 26 | +Benefits: |
| 27 | +- Prevents users from directly downloading the source PDF |
| 28 | +- Allows enforcing authentication, authorization, and logging on the server |
| 29 | +- Supports secure server‑side caching |
| 30 | + |
| 31 | +### Protect Document URLs |
| 32 | +For sensitive files: |
| 33 | +- Avoid exposing direct file URLs |
| 34 | +- Use authenticated endpoints |
| 35 | +- Validate JWT / session tokens before sending PDF content |
| 36 | +- Stream PDFs only after authorization checks |
| 37 | + |
| 38 | +### Token‑Based Access |
| 39 | +Pass security tokens through: |
| 40 | +- Custom headers |
| 41 | +- Secure cookies |
| 42 | +- Encrypted query parameters (backend‑validated) |
| 43 | + |
| 44 | +This ensures only authenticated requests reach the viewer. |
| 45 | + |
| 46 | +## Disable Download / Print |
| 47 | +You can restrict user access to sensitive document features by disabling PDF Viewer modules. |
| 48 | + |
| 49 | +### Disable Download |
| 50 | +Remove the default download button by using custom toolbar settings or excluding download‑related services. |
| 51 | + |
| 52 | +### Disable Print |
| 53 | +Remove the `Print` module. |
| 54 | +When excluded, printing options do not appear on the viewer toolbar. |
| 55 | + |
| 56 | +### Disable Copy / Extract Text |
| 57 | +Disable: |
| 58 | +- `TextSelection` |
| 59 | +- `TextSearch` |
| 60 | + |
| 61 | +These modules perform background text extraction. |
| 62 | +Removing them prevents text copying entirely. |
| 63 | + |
| 64 | +Example: |
| 65 | +```jsx |
| 66 | +<Inject services={[Toolbar, Navigation, Magnification]} /> |
| 67 | +``` |
| 68 | + |
| 69 | +This produces a view‑only, non‑copiable experience. |
| 70 | + |
| 71 | +## Use Signed or Protected PDFs |
| 72 | +The Syncfusion PDF Viewer fully supports: |
| 73 | +- **AES‑encrypted PDFs** |
| 74 | +- **Password‑protected PDFs** |
| 75 | +- **Permission‑restricted PDFs** (e.g., no‑print, no‑copy) |
| 76 | + |
| 77 | +When loading a protected PDF, the viewer **honors all embedded restrictions**. |
| 78 | + |
| 79 | +### Password‑Protected PDFs |
| 80 | +From your attached file: |
| 81 | + |
| 82 | +- If a password‑protected file is opened through the **Open File dialog**, the viewer automatically displays the password prompt. |
| 83 | + |
| 84 | +- When loading programmatically, the password can be passed directly via `viewer.load(url, password)`. |
| 85 | + |
| 86 | + |
| 87 | +Example: |
| 88 | +```js |
| 89 | +viewer.load( |
| 90 | + 'https://your-server/document.pdf', |
| 91 | + 'Password' |
| 92 | +); |
| 93 | +``` |
| 94 | + |
| 95 | +The viewer validates the password and decrypts the document. |
| 96 | + |
| 97 | +## Watermarking & Redaction |
| 98 | + |
| 99 | +### Dynamic Watermarks |
| 100 | +You can apply dynamic text‑based watermarks (username, timestamp, IP address) before loading the PDF via backend processing. |
| 101 | +Useful for: |
| 102 | +- Preventing screenshot leaks |
| 103 | +- Tracking document distribution |
| 104 | + |
| 105 | +### Redaction Workflows |
| 106 | +The React PDF Viewer supports secure redaction workflows for permanently removing sensitive content. |
| 107 | + |
| 108 | +Redaction capabilities are documented in the Syncfusion example repository. |
| 109 | + |
| 110 | +Supported patterns: |
| 111 | +- Marking redaction areas |
| 112 | +- Reviewing and applying changes |
| 113 | +- **Flattening** after redaction to permanently delete content |
| 114 | + |
| 115 | +## Secure Annotation & Collaboration Patterns |
| 116 | +Syncfusion documents multiple secure, role‑based annotation strategies: |
| 117 | + |
| 118 | +### Role‑Based Control |
| 119 | +Examples: |
| 120 | +- **Viewer**: can only read |
| 121 | +- **Commenter**: can add comments but not shapes |
| 122 | +- **Editor**: can modify all annotations |
| 123 | +- **Admin**: full rights including redaction |
| 124 | + |
| 125 | +### Locking Annotations |
| 126 | +Annotations can be: |
| 127 | +- Locked |
| 128 | +- Restricted by author |
| 129 | +- Filtered by role |
| 130 | + |
| 131 | +This prevents unauthorized editing of sensitive markups. |
| 132 | + |
| 133 | +### Finalizing Documents (Flattening) |
| 134 | +Flattening annotations ensures: |
| 135 | +- No further edits are possible |
| 136 | +- Signatures and markups become part of the PDF content |
| 137 | + |
| 138 | +Flattening is recommended in legal and compliance scenarios. |
| 139 | + |
| 140 | +--- |
| 141 | + |
| 142 | +## Prevent PDF Access Leakage |
| 143 | + |
| 144 | +### Avoid Exposing Raw PDFs |
| 145 | +When using Standalone mode (`resourceUrl` + WASM), the PDF is downloaded into the browser. |
| 146 | +For confidential files, prefer **Server‑Backed mode**, where the browser receives processed output, not the original PDF. |
| 147 | + |
| 148 | + |
| 149 | +### Disable Thumbnail & Page Extract Modules (Optional) |
| 150 | +Thumbnail rendering and page organizing load page previews that may contain sensitive data. |
| 151 | +If not needed, disable: |
| 152 | +- `ThumbnailView` |
| 153 | +- `PageOrganizer` |
| 154 | + |
| 155 | +## Summary |
| 156 | +| Pattern | Purpose | |
| 157 | +|--------|---------| |
| 158 | +| Server‑Backed Viewer | Keep documents on server; prevent raw PDF exposure | |
| 159 | +| Disable download/print/copy | Prevent distribution or extraction of sensitive content | |
| 160 | +| Use protected PDFs | Enforce password-based and permission-based security | |
| 161 | +| Watermarking | Prevent leaks via screenshot tracing | |
| 162 | +| Redaction | Permanently remove confidential content | |
| 163 | +| Role‑based annotation control | Restrict who can comment, edit, or sign | |
| 164 | +| Flattening | Finalize documents for compliant sharing | |
| 165 | + |
| 166 | +## See Also |
| 167 | +- [Loading Password‑Protected PDFs](../document-handling/load-password-pdf) |
| 168 | +- [Server‑Backed Viewer Setup](../getting-started-with-server-backed) |
| 169 | +- [Redaction](../Redaction/overview) |
0 commit comments