Skip to content

Commit 4668948

Browse files
committed
PDF Viewer - Docs update
1 parent 2152690 commit 4668948

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

docs/docs/05-components/pdf-viewer.mdx

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,15 @@ The Blazor PDF Viewer component allows users to view PDF files directly in the b
2020
| Name | Type | Default | Required | Description | Added Version |
2121
|:--|:--|:--|:--|:--|:--|
2222
| Orientation | `Orientation` | `Orientation.Portrait` | | Gets or sets the preferred orientation for the PDF viewer. | 2.1.0 |
23+
| Password | string | null | | Gets or sets the password required to open password-protected PDF documents. | 3.5.0 |
2324
| Url | string | null | ✔️ | Gets or sets the URL of the PDF document to be displayed. PDF Viewer component supports base64 string as a URL. | 1.11.0 |
2425

2526
## Callback Events
2627

2728
| Event | Description | Added Version |
2829
|:--|:--|:--|
2930
| OnDocumentLoaded | This event fires immediately after the PDF document is loaded. | 1.11.0 |
31+
| OnDocumentLoadError | This event fires if there is an error loading the PDF document. | 3.5.0 |
3032
| OnPageChanged | This event fires immediately after the page is changed. | 1.11.0 |
3133

3234
## Examples
@@ -148,3 +150,41 @@ Below screenshot is added for demo purposes only. For additional info, refer to
148150
=> eventLog = $"Last event: OnPageChanged, CurrentPage: {args.CurrentPage}, TotalPages: {args.TotalPages}";
149151
}
150152
```
153+
154+
### Password protected
155+
156+
To open a password-protected PDF document, set the <code>Password</code> parameter to the required password.
157+
158+
<img src="" alt="Blazor Bootstrap: Blazor PDF Viewer Component - Password protected" />
159+
160+
```cshtml {} showLineNumbers
161+
<PdfViewer Class="mb-3"
162+
Url="@($"{StringConstants.DocsBasePath}/pdf_password_protected.pdf")"
163+
Password="12345" />
164+
```
165+
166+
[See demo here.](https://demos.blazorbootstrap.com/pdf-viewer#password-protected)
167+
168+
### Prompt for password
169+
170+
If the <code>Password</code> parameter is not set and the PDF document is password-protected, the PDF Viewer component will prompt the user to enter the password.
171+
In the following example, the PDF Viewer prompts the user to enter the password for the protected PDF document. Enter <b>12345</b> as the password to view the document.
172+
173+
<img src="" alt="Blazor Bootstrap: Blazor PDF Viewer Component - Prompt for password" />
174+
175+
```cshtml {} showLineNumbers
176+
@if (showPdfViewer)
177+
{
178+
<PdfViewer Class="mb-3" Url="@($"{StringConstants.DocsBasePath}/pdf_password_protected.pdf")" PromptForPassword="true" />
179+
}
180+
else
181+
{
182+
<Button Class="btn btn-secondary mb-3" @onclick="() => showPdfViewer = true">Load Password Protected PDF (Prompt for Password)</Button>
183+
}
184+
185+
@code {
186+
private bool showPdfViewer = false;
187+
}
188+
```
189+
190+
[See demo here.](https://demos.blazorbootstrap.com/pdf-viewer#prompt-for-password)

0 commit comments

Comments
 (0)