-
Notifications
You must be signed in to change notification settings - Fork 10
978978: Added the documentation for the document security viewing #1494
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
07b82b5
978978: Added the documentation for the document security viewing
Tamilselvan-Durairaj 96f0acf
978978: Update the CI failures
Tamilselvan-Durairaj 3457d33
978978: Update the review correction
Tamilselvan-Durairaj 9e4775d
978978: Added the image for incorrect password
Tamilselvan-Durairaj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
Document-Processing/PDF/PDF-Viewer/blazor/document-security.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. |
67 changes: 67 additions & 0 deletions
67
Document-Processing/PDF/PDF-Viewer/blazor/document-security/password-protected.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: | ||
|
|
||
|  | ||
|
|
||
| Mobile password prompt: | ||
|
|
||
|  | ||
|
|
||
| - 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: | ||
|
|
||
|  | ||
|
|
||
| Invalid password error in Mobile: | ||
|
|
||
|  | ||
|
|
||
| - 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) | ||
53 changes: 53 additions & 0 deletions
53
Document-Processing/PDF/PDF-Viewer/blazor/document-security/permission.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
|
|
||
|  | ||
|
|
||
| ## 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) |
Binary file added
BIN
+38.6 KB
Document-Processing/PDF/PDF-Viewer/blazor/images/document-security.png
GokulprasathVenkatachalam marked this conversation as resolved.
Show resolved
Hide resolved
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+25.7 KB
Document-Processing/PDF/PDF-Viewer/blazor/images/password-incorrect-desktop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+25.2 KB
Document-Processing/PDF/PDF-Viewer/blazor/images/password-incorrect-mobile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+25.5 KB
Document-Processing/PDF/PDF-Viewer/blazor/images/password-ui-desktop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+26 KB
Document-Processing/PDF/PDF-Viewer/blazor/images/password-ui-mobile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.