Skip to content

Commit 07b82b5

Browse files
978978: Added the documentation for the document security viewing
1 parent 2c60786 commit 07b82b5

File tree

7 files changed

+136
-0
lines changed

7 files changed

+136
-0
lines changed

Document-Processing-toc.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,12 @@
539539
</li>
540540
<li> <a href="/document-processing/pdf/pdf-viewer/blazor/form-filling">Form Filling</a></li>
541541
<li> <a href="/document-processing/pdf/pdf-viewer/blazor/print">Print</a></li>
542+
<li> <a href="/document-processing/pdf/pdf-viewer/blazor/document-security">Document security</a>
543+
<ul>
544+
<li><a href="/document-processing/pdf/pdf-viewer/blazor/document-security/password-protected">Password Protected</a></li>
545+
<li><a href="/document-processing/pdf/pdf-viewer/blazor/document-security/permission">Permission</a></li>
546+
</ul>
547+
</li>
542548
<li> <a href="/document-processing/pdf/pdf-viewer/blazor/events">Events</a></li>
543549
<li> <a href="/document-processing/pdf/pdf-viewer/blazor/globalization">Globalization and RTL</a></li>
544550
<li>How To
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
layout: post
3+
title: Load the security documents in Blazor SfPdfViewer Component | Syncfusion
4+
description: Learn how Blazor SfPdfViewer opens password-protected PDFs and enforces owner permissions like print, copy and edit.
5+
platform: document-processing
6+
control: SfPdfViewer
7+
documentation: ug
8+
---
9+
10+
# Document security in Blazor SfPdfViewer
11+
12+
This article describes how the Blazor PDF Viewer (SfPdfViewer) handles secured PDF documents, including password-protected files and documents with permission restrictions. It also outlines expected behavior when opening these files and links to task-focused guides.
13+
14+
The PDF specification supports two primary security configurations:
15+
16+
- Password-protected (user/open password required to decrypt and open the file)
17+
- Permission-restricted (owner password sets granular permissions such as printing, copying, editing, annotating, and form filling)
18+
19+
Behavior and expectations:
20+
- When a password-protected PDF is loaded, the viewer prompts for the password. If the password is incorrect or omitted, the document does not open.
21+
- For permission-restricted PDFs, the viewer reads and enforces the document’s security flags. Disallowed actions (for example, print, copy, or annotate) are disabled in the UI and blocked through APIs.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
layout: post
3+
title: Load password-protected PDFs in Blazor SfPdfViewer | Syncfusion
4+
description: Learn how Blazor SfPdfViewer opens password-protected PDFs, prompts for passwords, and respects document permissions.
5+
platform: document-processing
6+
control: SfPdfViewer
7+
documentation: ug
8+
---
9+
10+
# Password-protected documents (open/user password)
11+
12+
Some PDFs require a password to open. When such a document is loaded in the viewer, the following behavior applies:
13+
14+
- A password prompt appears if the document requires an open/user password.
15+
- If the correct password is provided, the document loads and becomes viewable per the document’s permissions.
16+
- If the password is incorrect, the viewer shows an error and continues to prompt until a valid password is entered or the operation is canceled.
17+
- If the operation is canceled, the document is not loaded.
18+
19+
The viewer displays a password prompt UI when a protected document is opened.
20+
21+
Desktop password prompt:
22+
23+
![Blazor PDF Viewer desktop password prompt](../images/password-ui-desktop.png)
24+
25+
Mobile password prompt:
26+
27+
![Blazor PDF Viewer mobile password prompt](../images/password-ui-mobile.png)
28+
29+
## Load the password-protected document programmatically
30+
31+
Use the [LoadAsync method](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerBase.html) to load a PDF from a file path, URL, or base64 data at runtime. Pass the password as the second parameter.
32+
33+
```cshtml
34+
35+
@using Syncfusion.Blazor.SfPdfViewer
36+
@using Syncfusion.Blazor.Buttons
37+
38+
<SfButton @onclick="clicked">Load Document</SfButton>
39+
<SfPdfViewer2 Height="100%" Width="100%" @ref="Viewer">
40+
</SfPdfViewer2>
41+
42+
@code{
43+
SfPdfViewer2 Viewer;
44+
45+
public async void clicked()
46+
{
47+
await Viewer.LoadAsync("wwwroot/pdf-succinctly-password-protected.pdf", "password");
48+
}
49+
}
50+
51+
```
52+
53+
[View sample in GitHub](https://github.com/SyncfusionExamples/blazor-pdf-viewer-examples/tree/master/Load%20and%20Save/Load%20the%20Security%20Document).
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
layout: post
3+
title: Load permission-restricted PDFs in Blazor SfPdfViewer | Syncfusion
4+
description: Learn how Blazor SfPdfViewer enforces owner permissions in permission-restricted PDFs, controlling print, copy, and edit
5+
platform: document-processing
6+
control: SfPdfViewer
7+
documentation: ug
8+
---
9+
10+
# Permission-restricted documents (Owner password and permissions)
11+
12+
PDFs can be secured with an owner password and a set of permissions that restrict operations even after opening the file. Examples include:
13+
14+
- Printing: fully allowed, low-resolution only, or disallowed
15+
- Content copying and extraction
16+
- Page or content editing
17+
- Commenting and annotations
18+
- Form filling and signing
19+
- Document assembly (page insertion/rotation)
20+
- Accessibility content extraction (screen readers)
21+
22+
The viewer respects these permission flags and disables restricted actions in its UI. It cannot bypass or elevate document permissions. For example, when printing is disallowed, the print action is not available; when copying is restricted, text selection may be limited or copy commands disabled.
23+
24+
UI when a permission-restricted document is loaded
25+
26+
![Blazor PDF Viewer permission-restricted UI](../images/document-security.png)
27+
28+
## Load the permission-protected document programmatically
29+
30+
Use the [LoadAsync method](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerBase.html) to load a PDF from a file path, URL, or base64 data at runtime. Provide the password parameter only if the PDF also has an open/user password.
31+
32+
```cshtml
33+
34+
@using Syncfusion.Blazor.SfPdfViewer
35+
@using Syncfusion.Blazor.Buttons
36+
37+
<SfButton @onclick="clicked">Load Document</SfButton>
38+
<SfPdfViewer2 Height="100%" Width="100%" @ref="Viewer">
39+
</SfPdfViewer2>
40+
41+
@code{
42+
SfPdfViewer2 Viewer;
43+
44+
public async void clicked()
45+
{
46+
await Viewer.LoadAsync("wwwroot/permission-protected.pdf", "password");
47+
}
48+
}
49+
50+
```
51+
52+
[View sample in GitHub](https://github.com/SyncfusionExamples/blazor-pdf-viewer-examples/tree/master/Load%20and%20Save/Load%20the%20Security%20Document).
53+
54+
## See Also
55+
56+
* [Password-protected documents](./password-protected)
38.9 KB
Loading
25.5 KB
Loading
26 KB
Loading

0 commit comments

Comments
 (0)