Skip to content

Commit b756cfb

Browse files
Merge pull request #1494 from syncfusion-content/978978-pv-security
978978: Added the documentation for the document security viewing
2 parents c9bc245 + 9e4775d commit b756cfb

File tree

9 files changed

+147
-0
lines changed

9 files changed

+147
-0
lines changed

Document-Processing-toc.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,12 @@
559559
</li>
560560
<li> <a href="/document-processing/pdf/pdf-viewer/blazor/form-filling">Form Filling</a></li>
561561
<li> <a href="/document-processing/pdf/pdf-viewer/blazor/print">Print</a></li>
562+
<li> <a href="/document-processing/pdf/pdf-viewer/blazor/document-security">Document security</a>
563+
<ul>
564+
<li><a href="/document-processing/pdf/pdf-viewer/blazor/document-security/password-protected">Password Protected</a></li>
565+
<li><a href="/document-processing/pdf/pdf-viewer/blazor/document-security/permission">Permission</a></li>
566+
</ul>
567+
</li>
562568
<li> <a href="/document-processing/pdf/pdf-viewer/blazor/events">Events</a></li>
563569
<li> <a href="/document-processing/pdf/pdf-viewer/blazor/globalization">Globalization and RTL</a></li>
564570
<li> <a href="/document-processing/pdf/pdf-viewer/blazor/faq">FAQ</a>
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 PDF Viewer | 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](./document-security/password-protected) (password required to decrypt and open the file)
17+
- [Permission-restricted](./document-security/permission) (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: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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
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 password.
15+
16+
The viewer displays a password prompt UI when a protected document is opened.
17+
18+
Desktop password prompt:
19+
20+
![Blazor PDF Viewer desktop password prompt](../images/password-ui-desktop.png)
21+
22+
Mobile password prompt:
23+
24+
![Blazor PDF Viewer mobile password prompt](../images/password-ui-mobile.png)
25+
26+
- If the correct password is provided, the document loads and becomes viewable per the document’s permissions.
27+
- 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.
28+
29+
Invalid password error in desktop:
30+
31+
![Blazor PDF Viewer desktop password error](../images/password-incorrect-desktop.png)
32+
33+
Invalid password error in Mobile:
34+
35+
![Blazor PDF Viewer mobile password error](../images/password-incorrect-mobile.png)
36+
37+
- If the operation is canceled, the document is not loaded.
38+
39+
## Load the password-protected document programmatically
40+
41+
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.
42+
43+
```cshtml
44+
45+
@using Syncfusion.Blazor.SfPdfViewer
46+
@using Syncfusion.Blazor.Buttons
47+
48+
<SfButton @onclick="clicked">Load Document</SfButton>
49+
<SfPdfViewer2 Height="100%" Width="100%" @ref="Viewer">
50+
</SfPdfViewer2>
51+
52+
@code{
53+
SfPdfViewer2 Viewer;
54+
55+
public async void clicked()
56+
{
57+
await Viewer.LoadAsync("wwwroot/pdf-succinctly-password-protected.pdf", "password");
58+
}
59+
}
60+
61+
```
62+
63+
[View sample in GitHub](https://github.com/SyncfusionExamples/blazor-pdf-viewer-examples/tree/master/Load%20and%20Save/Load%20the%20Security%20Document).
64+
65+
## See Also
66+
67+
* [Permission-protected documents](./permission)
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 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: allowed or disallowed
15+
- Content copying
16+
- Page editing
17+
- Commenting and annotations
18+
19+
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.
20+
21+
UI when a permission-restricted document is loaded
22+
23+
![Blazor PDF Viewer permission-restricted UI](../images/document-security.png)
24+
25+
## Load the permission-protected document programmatically
26+
27+
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.
28+
29+
```cshtml
30+
31+
@using Syncfusion.Blazor.SfPdfViewer
32+
@using Syncfusion.Blazor.Buttons
33+
34+
<SfButton @onclick="clicked">Load Document</SfButton>
35+
<SfPdfViewer2 Height="100%" Width="100%" @ref="Viewer">
36+
</SfPdfViewer2>
37+
38+
@code{
39+
SfPdfViewer2 Viewer;
40+
41+
public async void clicked()
42+
{
43+
await Viewer.LoadAsync("wwwroot/permission-protected.pdf", "password");
44+
}
45+
}
46+
47+
```
48+
49+
[View sample in GitHub](https://github.com/SyncfusionExamples/blazor-pdf-viewer-examples/tree/master/Load%20and%20Save/Load%20the%20Security%20Document).
50+
51+
## See Also
52+
53+
* [Password-protected documents](./password-protected)
38.6 KB
Loading
25.7 KB
Loading
25.2 KB
Loading
25.5 KB
Loading
26 KB
Loading

0 commit comments

Comments
 (0)