Skip to content
Merged
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
6 changes: 6 additions & 0 deletions Document-Processing-toc.html
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,12 @@
</li>
<li> <a href="/document-processing/pdf/pdf-viewer/blazor/form-filling">Form Filling</a></li>
<li> <a href="/document-processing/pdf/pdf-viewer/blazor/print">Print</a></li>
<li> <a href="/document-processing/pdf/pdf-viewer/blazor/document-security">Document security</a>
<ul>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/document-security/password-protected">Password Protected</a></li>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/document-security/permission">Permission</a></li>
</ul>
</li>
<li> <a href="/document-processing/pdf/pdf-viewer/blazor/events">Events</a></li>
<li> <a href="/document-processing/pdf/pdf-viewer/blazor/globalization">Globalization and RTL</a></li>
<li>How To
Expand Down
21 changes: 21 additions & 0 deletions Document-Processing/PDF/PDF-Viewer/blazor/document-security.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
layout: post
title: Load the security documents in Blazor PDF Viewer | Syncfusion
description: Learn how Blazor SfPdfViewer opens password-protected PDFs and enforces owner permissions like print, copy and edit.
platform: document-processing
control: SfPdfViewer
documentation: ug
---

# Document security in Blazor SfPdfViewer

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.

The PDF specification supports two primary security configurations:

- [Password-protected](./document-security/password-protected) (password required to decrypt and open the file)
- [Permission-restricted](./document-security/permission) (owner password sets granular permissions such as printing, copying, editing, annotating, and form filling)

Behavior and expectations:
- 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.
- 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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
layout: post
title: Load password-protected PDFs in Blazor SfPdfViewer | Syncfusion
description: Learn how Blazor SfPdfViewer opens password-protected PDFs, prompts for passwords, and respects document permissions.
platform: document-processing
control: SfPdfViewer
documentation: ug
---

# Password-protected documents

Some PDFs require a password to open. When such a document is loaded in the viewer, the following behavior applies:

- A password prompt appears if the document requires an password.

The viewer displays a password prompt UI when a protected document is opened.

Desktop password prompt:

![Blazor PDF Viewer desktop password prompt](../images/password-ui-desktop.png)

Mobile password prompt:

![Blazor PDF Viewer mobile password prompt](../images/password-ui-mobile.png)

- If the correct password is provided, the document loads and becomes viewable per the document’s permissions.
- 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.

Invalid password error in desktop:

![Blazor PDF Viewer desktop password error](../images/password-incorrect-desktop.png)

Invalid password error in Mobile:

![Blazor PDF Viewer mobile password error](../images/password-incorrect-mobile.png)

- If the operation is canceled, the document is not loaded.

## Load the password-protected document programmatically

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.

```cshtml
@using Syncfusion.Blazor.SfPdfViewer
@using Syncfusion.Blazor.Buttons
<SfButton @onclick="clicked">Load Document</SfButton>
<SfPdfViewer2 Height="100%" Width="100%" @ref="Viewer">
</SfPdfViewer2>
@code{
SfPdfViewer2 Viewer;
public async void clicked()
{
await Viewer.LoadAsync("wwwroot/pdf-succinctly-password-protected.pdf", "password");
}
}
```

[View sample in GitHub](https://github.com/SyncfusionExamples/blazor-pdf-viewer-examples/tree/master/Load%20and%20Save/Load%20the%20Security%20Document).

## See Also

* [Permission-protected documents](./permission)
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
layout: post
title: Load permission-restricted PDFs in Blazor SfPdfViewer | Syncfusion
description: Learn how Blazor SfPdfViewer enforces owner permissions in permission-restricted PDFs, controlling print, copy, and edit
platform: document-processing
control: SfPdfViewer
documentation: ug
---

# Permission-restricted documents (Owner password and permissions)

PDFs can be secured with an owner password and a set of permissions that restrict operations even after opening the file. Examples include:

- Printing: allowed or disallowed
- Content copying
- Page editing
- Commenting and annotations

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.

UI when a permission-restricted document is loaded

![Blazor PDF Viewer permission-restricted UI](../images/document-security.png)

## Load the permission-protected document programmatically

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.

```cshtml
@using Syncfusion.Blazor.SfPdfViewer
@using Syncfusion.Blazor.Buttons
<SfButton @onclick="clicked">Load Document</SfButton>
<SfPdfViewer2 Height="100%" Width="100%" @ref="Viewer">
</SfPdfViewer2>
@code{
SfPdfViewer2 Viewer;
public async void clicked()
{
await Viewer.LoadAsync("wwwroot/permission-protected.pdf", "password");
}
}
```

[View sample in GitHub](https://github.com/SyncfusionExamples/blazor-pdf-viewer-examples/tree/master/Load%20and%20Save/Load%20the%20Security%20Document).

## See Also

* [Password-protected documents](./password-protected)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.