diff --git a/Document-Processing/PDF/PDF-Viewer/blazor/document-handling/load-large-pdf.md b/Document-Processing/PDF/PDF-Viewer/blazor/document-handling/load-large-pdf.md
index aaa24a3bfb..bcc4c9ae0a 100644
--- a/Document-Processing/PDF/PDF-Viewer/blazor/document-handling/load-large-pdf.md
+++ b/Document-Processing/PDF/PDF-Viewer/blazor/document-handling/load-large-pdf.md
@@ -10,7 +10,7 @@ domainurl: ##DomainURL##
# Load Large PDF Files in Blazor PDF Viewer
-This section explains how to load and render **large PDF files (up to approximately 1 GB)** efficiently using the Syncfusion Blazor PDF Viewer. It also covers the recommended configurations required to achieve stable and responsive performance while working with large documents.
+This section explains how to load and render **large PDF files (up to approximately 1 GB)** efficiently using the Blazor PDF Viewer. It also covers the recommended configurations required to achieve stable and responsive performance while working with large documents.
## Why Large PDFs Require Special Handling
@@ -35,8 +35,6 @@ With proper configuration, the Blazor PDF Viewer can:
N> Large PDF support depends on enabling chunk-based processing (refer [EnableChunkMessages](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerBase.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerBase_EnableChunkMessages)) and proper server configuration. The actual supported size may vary based on browser memory limits, server settings, and system resources.
----
-
## Best Practices for Loading Large PDFs
### 1. Enable Chunk‑Based Processing
@@ -45,7 +43,7 @@ Chunk-based processing is **mandatory** for loading large PDF files in the Blazo
Refer to the following FAQ to configure chunk-based processing:
-- [How to process Larges files using EnableChunkMessages](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/blazor/faqs/how-to-processing-large-files-without-increasing-maximum-message-size)
+- [How to process Large files using EnableChunkMessages](../faqs/how-to-processing-large-files-without-increasing-maximum-message-size)
Ensure that:
@@ -53,19 +51,28 @@ Ensure that:
- Chunk processing is enabled as documented
- Connection buffer limits are configured correctly
-### 2. Load Large PDFs Using `DocumentPath`
+### 2. Load Large PDFs Using DocumentPath
For large documents, it is recommended to load the PDF using the [DocumentPath](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerBase.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerBase_DocumentPath) property.
Using `DocumentPath` helps:
- Initiate chunk-based requests immediately
-- Avoid loading the entire document into memory
+- Avoid buffering the entire file in client memory
- Improve stability and loading behavior for large files
This approach is suitable for PDFs hosted on servers, secured APIs, or cloud storage endpoints.
----
+Example usage:
+
+```cshtml
+@using Syncfusion.Blazor.SfPdfViewer
+
+
+```
### 3. Optimize Network and Performance Configuration
@@ -75,7 +82,7 @@ Proper network configuration plays a critical role in rendering large PDFs.
Configuring a sufficient connection buffer size helps prevent interruptions while loading large documents:
-- [How to increase connection Buffer size](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/blazor/faqs/how-to-increase-connection-buffer-size)
+- [How to increase connection buffer size](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/blazor/faqs/how-to-increase-connection-buffer-size)
#### Use CDN for Improved Performance
@@ -83,21 +90,21 @@ Using CDN resources reduces script download time and improves viewer initializat
- [How to improve performance using CDN](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/blazor/faqs/how-to-improve-performance-using-cdn)
----
-
### 4. Reduce System Resource Load
Rendering large PDF files also depends on available system resources.
-For the best experience:
+For the best experience, follow these steps:
-- Close unused applications
-- Minimize open browser tabs
-- Avoid running multiple heavy tasks in parallel
-- Do not open multiple large PDFs at the same time
+1. Close unused applications.
+2. Minimize open browser tabs.
+3. Avoid running multiple heavy tasks in parallel.
+4. Avoid opening multiple large PDFs at the same time.
+5. Verify that adequate system memory and CPU are available before loading the file.
-Ensuring adequate system memory and CPU availability helps maintain smooth rendering and interaction.
## See Also
-- [Load and Save Sample](https://github.com/SyncfusionExamples/blazor-pdf-viewer-examples/tree/master/Load%20and%20Save)
\ No newline at end of file
+- [Load a Password-Protected PDF](./load-password-pdf)
+- [Getting started with SfPdfViewer in a Blazor Web App](../getting-started/web-app)
+- [Load and Save Sample](https://github.com/SyncfusionExamples/blazor-pdf-viewer-examples/tree/master/Load%20and%20Save)
diff --git a/Document-Processing/PDF/PDF-Viewer/blazor/document-handling/load-password-pdf.md b/Document-Processing/PDF/PDF-Viewer/blazor/document-handling/load-password-pdf.md
index e3eb1ac5ed..01070bd7df 100644
--- a/Document-Processing/PDF/PDF-Viewer/blazor/document-handling/load-password-pdf.md
+++ b/Document-Processing/PDF/PDF-Viewer/blazor/document-handling/load-password-pdf.md
@@ -10,63 +10,72 @@ domainurl: ##DomainURL##
# Load a Password-Protected PDF in Blazor
-This article explains how to open password-protected PDF files in the Syncfusion Blazor PDF Viewer. The viewer supports both user‑interactive loading (Open File dialog) and programmatic loading using APIs.
+This article explains how to open password-protected PDF files in the Blazor PDF Viewer. The viewer supports both user-interactive loading (the built-in **Open File** dialog) and programmatic loading using APIs.
-## 1. Opening a Password-Protected PDF Using the **Open File** Dialog
+## Opening a Password-Protected PDF Using the **Open File** Dialog
-When the user selects a password-protected PDF using the built‑in **Open File** option:
+When the user clicks the built-in **Open File** button in the PDF Viewer toolbar and selects a password-protected PDF:
-- The viewer detects that the document is encrypted
+- The viewer detects that the document is encrypted on the server side
-
+
- A **password input popup** is automatically displayed
-
+
- The user enters the password
-
- The document is decrypted and loaded
-No additional configuration or code is required.
+No additional configuration or code is required. This approach works for all password-protected PDFs opened locally by the user.
+
+## Opening a Password-Protected PDF Programmatically
-This approach works for all password-protected PDFs opened locally by the user.
+Use the programmatic APIs when the password is known in advance or when the document is hosted on a server. The viewer supports both the `LoadAsync` overloads and the `DocumentPath` property.
-## 2. Opening a Password-Protected PDF Programmatically
+### Load the Document Using `LoadAsync`
-If you load a password-protected PDF from a URL or through custom logic, the viewer provides two behaviors depending on how the file is loaded.
+The [`LoadAsync`](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerBase.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerBase_LoadAsync_System_Byte___System_String_) method accepts a password parameter. The two supported overloads are:
-### 2.1 Load the Document Using `LoadAsync(byte[] bytes, string password = null)`
+- `LoadAsync(byte[] bytes, string password = null)` — pass the PDF as a byte array
+- `LoadAsync(string document, string password = null)` — pass a URL or server-relative path
-You can directly pass the password in the [`load`](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerBase.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerBase_LoadAsync_System_Byte___System_String_) method:
+**Example (byte array):**
```cs
-@using Syncfusion.Blazor.SfPdfViewer
+@using Syncfusion.Blazor
@using Syncfusion.Blazor.Buttons
+@using Syncfusion.Blazor.SfPdfViewer
-Load Document
+Load Document
-@code{
+@code {
SfPdfViewer2 Viewer;
- public async void clicked()
+ private async Task Clicked()
{
await Viewer.LoadAsync("wwwroot/pdf-succinctly-password-protected.pdf", "password");
}
}
```
-- If the password is correct → the PDF loads immediately
-- If the password is incorrect → the viewer displays the incorrect password popup
-- If no password is provided → the password popup is shown automatically
+N> The password parameter is consumed for the current load operation only and is not cached across re-renders. If the document is reloaded, supply the password again.
+
+**Outcomes**
+
+| Password state | Result |
+|---|---|
+| Correct | The PDF loads immediately |
+| Incorrect | The viewer displays the incorrect password popup |
+| Null or empty | The password popup is shown automatically |
-This is useful when the password is known beforehand.
+N> Handle incorrect-password events through the [`DocumentLoadFailed`](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerEvents.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerEvents_DocumentLoadFailed) event to surface custom error messages.
-### 2.2 Loading a Password-Protected Document's URL Using `documentPath`
+### Loading a Password-Protected Document via `DocumentPath`
-If the [`documentPath`](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerBase.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerBase_DocumentPath) points to a password-protected PDF:
+When the [`DocumentPath`](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerBase.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerBase_DocumentPath) property points to a password-protected PDF, the viewer detects the encryption and prompts the user for the password automatically.
```cs
@using Syncfusion.Blazor
@@ -78,18 +87,23 @@ If the [`documentPath`](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.
@code {
- //Load URL for Passwrod-Protected Document in DocumentPath
- public string DocumentPath { get; set; } = "https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf";
+ // URL for the password-protected sample document
+ public string DocumentPath { get; set; } = "https://cdn.syncfusion.com/content/pdf/pdf-succinctly-password-protected.pdf";
}
```
+N> Do not pass the password as a query string inside `DocumentPath`.
+
The viewer will:
-- Detect encryption
+- Detect encryption on the server
- Show the **password popup automatically**
- Allow the user to enter the correct password
-- Then load the PDF
+- Decrypt and load the PDF
+
+
-
+## See Also
-N> No password should be passed inside `documentPath`.
\ No newline at end of file
+- [Load Large PDF Files](./load-large-pdf)
+- [Getting started with SfPdfViewer in a Blazor Web App](../getting-started/web-app)
diff --git a/Document-Processing/PDF/PDF-Viewer/blazor/document-handling/preprocess-pdf.md b/Document-Processing/PDF/PDF-Viewer/blazor/document-handling/preprocess-pdf.md
index 3f6a2106e4..907d1db116 100644
--- a/Document-Processing/PDF/PDF-Viewer/blazor/document-handling/preprocess-pdf.md
+++ b/Document-Processing/PDF/PDF-Viewer/blazor/document-handling/preprocess-pdf.md
@@ -10,17 +10,17 @@ domainurl: ##DomainURL##
# Pre-process PDF Document Before Displaying in Blazor PDF Viewer
-This section explains why preprocessing is useful, what operations you can perform using the Syncfusion PDF Library and Blazor PDF Viewer, and how to load the processed document in the Blazor PDF Viewer.
+This section explains why preprocessing is useful, what operations you can perform using the Syncfusion® PDF Library and Blazor PDF Viewer, and how to load the processed document in the Blazor PDF Viewer.
## Why Preprocessing Is Needed
Preprocessing a PDF before sending it to the viewer helps you:
-- Reduce file size and improve load time
-- Merge multiple documents into one
-- Extract only required pages for faster loading
-- Flatten form fields and annotations for performance & security
-- Apply branding elements such as watermarks or stamps
+- **Reduce file size** — Compresses content to improve load time.
+- **Merge multiple documents** — Combine several PDFs into a single file.
+- **Extract only required pages** — Drop unused pages for faster loading.
+- **Flatten form fields and annotations** — Improves rendering performance and prevents further editing.
+- **Apply branding elements** — Such as watermarks or stamps.
-These enhancements ensure a better, faster, and more controlled viewing experience.
+Each enhancement maps directly to a measurable improvement in load time, rendering speed, or document control.
## Merge PDF Documents
### UI-Level Merging
@@ -31,11 +31,11 @@ You can visually merge pages in the **Organize Pages** UI inside the Blazor PDF
For more details, refer to [UI Interactions - Import Pages](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/blazor/organize-pages/ui-interactions#import-pages).
### Programmatically Merge PDFs
-Using the Syncfusion PDF Viewer, you can merge documents before loading them into the viewer.
+Using the Blazor PDF Viewer, you can merge documents before loading them into the viewer.
For more details, refer to [Programmatic Support - Import Pages](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/blazor/organize-pages/programmatic-support#import-pages).
-N> You can then load the merged PDF into the viewer using a file path or stream.
+N> You can then load the merged PDF into the viewer using a file path, stream, or byte array.
## Extract Pages
### UI-Level Extraction
@@ -60,7 +60,7 @@ For more details, refer to [Programmatic Support - Export Pages](https://help.sy
Use the following code-snippet when you want uploaded PDFs to be flattened before they are loaded into the viewer.
-```cs
+```csharp
@page "/"
@using Syncfusion.Blazor
@using Syncfusion.Blazor.SfPdfViewer
@@ -68,7 +68,7 @@ Use the following code-snippet when you want uploaded PDFs to be flattened befor
@using Syncfusion.Pdf.Parsing
-@code{
+@code {
private SfPdfViewer2? Viewer;
async Task OnCreated()
{
@@ -111,6 +111,8 @@ The Blazor PDF Viewer toolbar allows users to:
### Programmatically Add a Watermark
+The following example loads an existing PDF, draws a watermark image on every page using `PdfGraphics`, and then reloads the result into the viewer. The image is loaded from a file in `wwwroot` and converted to a `byte[]` — the recommended approach over hard-coding base64.
+
```csharp
@page "/"
@using Syncfusion.Blazor
@@ -171,21 +173,25 @@ You can load the processed PDF using a remote URL, stream, or byte array and bas
### Load From Remote URL
-Refer to the Syncfusion Blazor PDF Viewer documentation for loading PDF from Remote URL. For more details, visit [Load PDF Document from Remote URL](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/blazor/opening-pdf-file#opening-a-pdf-from-remote-url).
+Refer to the Blazor PDF Viewer documentation for loading PDF from Remote URL. For more details, visit [Load PDF Document from Remote URL](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/blazor/opening-pdf-file#opening-a-pdf-from-remote-url).
https://help.syncfusion.com/document-processing/pdf/pdf-viewer/blazor/opening-pdf-file#opening-a-pdf-from-remote-url
### Load Using Stream or Byte Array
-Refer to the Syncfusion Blazor PDF Viewer documentation for loading PDF from stream or byte array. For more details, visit [Load PDF Document from Stream](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/blazor/opening-pdf-file#opening-a-pdf-from-stream).
+Refer to the Blazor PDF Viewer documentation for loading PDF from stream or byte array. For more details, visit [Load PDF Document from Stream](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/blazor/opening-pdf-file#opening-a-pdf-from-stream).
### Load Using base64 Data
-Refer to the Syncfusion Blazor PDF Viewer documentation for loading PDF from base64 data. For more details, visit [Load PDF Document from base64 Data](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/blazor/opening-pdf-file#opening-a-pdf-from-base64-data).
+Refer to the Blazor PDF Viewer documentation for loading PDF from base64 data. For more details, visit [Load PDF Document from base64 Data](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/blazor/opening-pdf-file#opening-a-pdf-from-base64-data).
## Additional Performance Tips
- **Render Multiple Pages While Scrolling:** Improve performance by rendering multiple pages during scrolling. For more details, refer to [How to render N pages while scrolling](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/blazor/faqs/how-to-render-n-pages-scrolling).
- **Improve Performance Using CDN:** Enhance viewer performance using a Content Delivery Network. For more details, refer to [How to improve performance using CDN](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/blazor/faqs/how-to-improve-performance-using-cdn).
+## See Also
+- [Load Large PDF Files](./load-large-pdf)
+- [Load a Password-Protected PDF](./load-password-pdf)
+- [Getting started with SfPdfViewer in a Blazor Web App](../getting-started/web-app)
diff --git a/Document-Processing/PDF/PDF-Viewer/blazor/document-handling/retrieve-viewer-instance.md b/Document-Processing/PDF/PDF-Viewer/blazor/document-handling/retrieve-viewer-instance.md
index 454bc29fd6..09d51f19b8 100644
--- a/Document-Processing/PDF/PDF-Viewer/blazor/document-handling/retrieve-viewer-instance.md
+++ b/Document-Processing/PDF/PDF-Viewer/blazor/document-handling/retrieve-viewer-instance.md
@@ -11,41 +11,39 @@ domainurl: ##DomainURL##
This page explains how to access the PDF Viewer instance in the Blazor PDF Viewer using Blazor component references, listen for the [DocumentLoaded](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerEvents.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerEvents_DocumentLoaded) event, and retrieve document information, page details, and metadata—so you can safely invoke viewer APIs after the PDF document is loaded.
-## Explanation: Why access the PDF Viewer instance?
+## Why Access the PDF Viewer Instance
-- The viewer instance (via **Blazor component reference**) gives you a stable handle to call APIs such as [`Zoom`](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/blazor/magnification), [`Print`](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/blazor/print), [`Download`](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/blazor/saving-pdf-file#download), and [`Navigation`](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/blazor/navigation).
+- The viewer instance (via **Blazor component reference**) gives you a stable handle to call APIs such as [`ZoomAsync`](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/blazor/magnification), [`PrintAsync`](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/blazor/print), [`DownloadAsync`](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/blazor/saving-pdf-file#download), and [`GoToPageAsync`](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/blazor/navigation).
- The **Created event** fires when the PDF Viewer component is rendered and initialized in the DOM.
-- The **DocumentLoaded event** (fires after the PDF document is fully loaded and parsed) is the correct moment to read **document information** (Document Name, page count) and **page metrics**, and to trigger post‑load UI logic. Use [DocumentLoaded](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerEvents.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerEvents_DocumentLoaded) event to access document details after successful load, and [DocumentLoadFailed](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerEvents.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerEvents_DocumentLoadFailed) to handle load failures.
-- Accessing the instance too early (before load completes) may cause null/undefined errors or incomplete information.
+- The **DocumentLoaded event** (fires after the PDF document is fully loaded and parsed) is the correct moment to read **document information** (Document Name, page count) and **page metrics**, and to trigger post-load UI logic. Use the [DocumentLoaded](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerEvents.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerEvents_DocumentLoaded) event to access document details after a successful load, and the [DocumentLoadFailed](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerEvents.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerEvents_DocumentLoadFailed) event to handle load failures.
+- Accessing the instance too early (before load completes) may cause null-reference errors or incomplete information.
-## Reference: What you can access/call after load
+## What You Can Access and Call After Load
-After the PDF is loaded you can:
+After the PDF is loaded, you can:
-- **Read document information**: title, author, subject, keywords (metadata), page count.
-- **Read page details**: total pages, current page, page size(s).
-- **Call Viewer APIs** (typical examples):
- - **[Zoom](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/blazor/magnification) / Fit**: `ZoomTo(125)`; fit to page/width
- - **[Navigation](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/blazor/navigation)**: go to a specific page
- - **[Interactions](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/blazor/interaction)**: Enable selection mode and panning
- - **Export**: [Download()](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/blazor/saving-pdf-file#download), [Print()](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/blazor/print).
+- **Read document information**: title, author, subject, keywords, and page count.
+- **Read page details**: total pages, current page, and page size.
+- **Call Viewer APIs**, for example:
+ - **[Zoom](../magnification)**: `ZoomAsync(zoomPercentage)`. Valid range: 50–400.
+ - **[Navigation](../interactive-pdf-navigation-overview)**: `GoToPageAsync(pageIndex)` where `pageIndex` is 1-based.
+ - **[Interactions](../interaction)**: enable selection mode, panning, and other interaction modes.
+ - **Export**: [DownloadAsync()](../saving-pdf-file#download) and [PrintAsync()](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/blazor/print). Both methods take no parameters and return `Task`.
-N> The **[Created event](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerEvents.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerEvents_Created)** triggers when the PDF Viewer component is rendered in the DOM. The **[DocumentLoaded event](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerEvents.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerEvents_DocumentLoaded)** triggers when the document is successfully loaded and parsed. Always invoke viewer APIs after the `DocumentLoaded` event fires to ensure document information is available, or from user actions that occur after load. Guard calls with null checks or readiness flags.
+N> The [Created](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerEvents.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerEvents_Created) event triggers when the PDF Viewer component is rendered in the DOM. The [DocumentLoaded](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerEvents.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerEvents_DocumentLoaded) event triggers when the document is successfully loaded and parsed.
-## How‑to: Get the instance with a ref and read details on load
+## Get the Instance with a Ref and Read Details on Load
-Below is a focused snippet showing:
-1) Creating a **component reference** for the viewer,
-2) Wiring the **[Created](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerEvents.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerEvents_Created)** event for viewer initialization and the **[DocumentLoaded](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerEvents.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerEvents_DocumentLoaded)** event for document details, and
-3) Reading basic **document info** (name and page count) from the **DocumentLoaded** event, then calling viewer APIs safely.
+The following example shows:
+1. Creating a **component reference** for the viewer,
+2. Wiring the [Created](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerEvents.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerEvents_Created) event for viewer initialization and the [DocumentLoaded](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerEvents.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerEvents_DocumentLoaded) event for document details, and
+3. Reading basic **document info** (name and page count) from the `DocumentLoaded` event, then calling viewer APIs safely.
-```cs
+```csharp
@page "/"
@using Syncfusion.Blazor
@using Syncfusion.Blazor.SfPdfViewer
-@using Syncfusion.Pdf
-@using Syncfusion.Pdf.Parsing
Document Info
@@ -55,7 +53,9 @@ Below is a focused snippet showing:
@@ -63,24 +63,34 @@ Below is a focused snippet showing:
private SfPdfViewer2? Viewer;
+ // DocumentInfo is a sample placeholder model. In a real project,
+ // place this class in a separate Models folder.
private DocumentInfo Info = new();
private async Task OnCreated()
{
// Created event: Fires when the PDF Viewer component is rendered
- await Viewer!.LoadAsync("wwwroot/pdf-succinctly.pdf");
+ if (Viewer is null) return;
+ await Viewer.LoadAsync("wwwroot/pdf-succinctly.pdf");
}
- private async Task OnDocumentLoaded(LoadEventArgs args)
+ private void OnDocumentLoaded(LoadEventArgs args)
{
// DocumentLoaded event: Fires when the document is successfully loaded
Info = new DocumentInfo
{
Name = args.DocumentName,
- PageCount = args.PageData.PageCount,
+ PageCount = args.PageCount,
};
}
+ private void OnDocumentLoadFailed(FailureEventArgs args)
+ {
+ // DocumentLoadFailed event: Fires when document loading fails
+ Console.Error.WriteLine($"Failed to load document: {args.ErrorMessage}");
+ // Handle the failure (for example, show a user-facing message)
+ }
+
class DocumentInfo
{
public string Name { get; set; } = "";
@@ -89,72 +99,120 @@ Below is a focused snippet showing:
}
```
-**Notes**
-- Use `SfPdfViewer2` component with `@ref` to get direct access to the viewer instance.
-- **Created event** triggers when the PDF Viewer component is rendered.
-- **DocumentLoaded event** triggers when the document is successfully loaded. Use this event to access document name, page count, and other document-specific details.
-- Call methods directly on the viewer reference like `Viewer.ZoomAsync()`, `Viewer.GoToPageAsync()`, etc.
+N> Use `SfPdfViewer2` component with `@ref` to get direct access to the viewer instance.
+N> `Created` event triggers when the PDF Viewer component is rendered.
+N> `DocumentLoaded` event triggers when the document is successfully loaded. Use this event to access document name, page count, and other document-specific details.
+N> Always null-check the `Viewer` reference before calling any viewer API. Methods such as `Viewer.ZoomAsync()`, `Viewer.GoToPageAsync()`, `Viewer.PrintAsync()`, and `Viewer.DownloadAsync()` are safe to invoke only after the `DocumentLoaded` event has fired or from a user action that occurs after load.
-## Tutorial: End‑to‑End — Call Viewer APIs with TextBox Input
+## End-to-End Example: Call Viewer APIs with TextBox Input
-This example demonstrates how to use text input with buttons to interact with the loaded PDF viewer:
+This example shows how to use text inputs with buttons to interact with the loaded PDF viewer, including reading document info, zooming, navigating, printing, and downloading.
-```cs
+```csharp
@page "/"
@using Syncfusion.Blazor.Buttons
@using Syncfusion.Blazor.Inputs
@using Syncfusion.Blazor.SfPdfViewer
-
-
+
+ Document Info
+ Name: @Info.Name
+ Pages: @Info.PageCount
-
Zoom
-
-
+
+
+
+
+
Zoom
+
+
+
+
+
Go To Page
+
Print
+
Download
-
Go To Page
-
Download
-
Print
+ @ref="@Viewer">
+
+
@code {
- SfPdfViewer2 Viewer;
- SfTextBox TextBox1;
- SfTextBox TextBox2;
+ private SfPdfViewer2? Viewer;
+ private SfTextBox? TextBox1;
+ private SfTextBox? TextBox2;
public string DocumentPath { get; set; } = "wwwroot/pdf-succinctly.pdf";
- // Access the loaded PDF Viewer instance - Zoom functionality
- public async void OnZoomClick(MouseEventArgs args)
+ private DocumentInfo Info = new();
+
+ // Read document information on load
+ private void OnDocumentLoaded(LoadEventArgs args)
{
- int zoomValue = int.Parse(TextBox1.Value.ToString());
- await Viewer.ZoomAsync(zoomValue);
+ Info = new DocumentInfo
+ {
+ Name = args.DocumentName,
+ PageCount = args.PageCount,
+ };
}
- // Navigate to a specific page
- public async void OnPageClick(MouseEventArgs args)
+
+ // Handle document load failures
+ private void OnDocumentLoadFailed(FailureEventArgs args)
+ {
+ Console.Error.WriteLine($"Failed to load document: {args.ErrorMessage}");
+ }
+
+ // Zoom functionality (valid range: 50-400)
+ private async Task OnZoomClick(MouseEventArgs args)
+ {
+ try
+ {
+ await Viewer.ZoomAsync(zoomValue);
+ }
+ catch (Exception ex)
+ {
+ Console.Error.WriteLine($"Zoom failed: {ex.Message}");
+ }
+ }
+
+ // Navigate to a specific 1-based page
+ private async Task OnPageClick(MouseEventArgs args)
{
- int pageIndex = int.Parse(TextBox2.Value.ToString());
- await Viewer.GoToPageAsync(pageIndex);
+ try
+ {
+ await Viewer.GoToPageAsync(pageIndex);
+ }
+ catch (Exception ex)
+ {
+ Console.Error.WriteLine($"Navigation failed: {ex.Message}");
+ }
}
-
+
// Print the PDF document
- public async void OnClick(MouseEventArgs args)
+ private async Task OnPrintClick(MouseEventArgs args)
{
- await Viewer.PrintAsync();
+ if (Viewer is null) return;
+ await Viewer.PrintAsync();
}
-
+
// Download the PDF document
- public async void OnClickDownload(MouseEventArgs args)
+ private async Task OnClickDownload(MouseEventArgs args)
{
- await Viewer.DownloadAsync();
+ if (Viewer is null) return;
+ await Viewer.DownloadAsync();
}
}
```
-## See also
-- [Blazor PDF Viewer –API Reference](https://help.syncfusion.com/cr/blazor/syncfusion.blazor.sfpdfviewer.sfpdfviewer2.html)
-- [Blazor FAQ](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/blazor/faq) (e.g., Magnification, Navigation, Print) — ensure the features you need are available
\ No newline at end of file
+## See Also
+
+- [Blazor PDF Viewer – API Reference](https://help.syncfusion.com/cr/blazor/syncfusion.blazor.sfpdfviewer.sfpdfviewer2.html)
+- [Magnification (Zoom) in Blazor PDF Viewer](../magnification)
+- [Navigation in Blazor PDF Viewer](../interactive-pdf-navigation-overview)
+- [Print PDF in Blazor PDF Viewer](../print/overview)
+- [Download PDF in Blazor PDF Viewer](../saving-pdf-file#download)
+- [Blazor PDF Viewer FAQ](../faq)
\ No newline at end of file
diff --git a/Document-Processing/PDF/PDF-Viewer/blazor/document-security/password-protected.md b/Document-Processing/PDF/PDF-Viewer/blazor/document-security/password-protected.md
index a677ad178f..d6b5014fcb 100644
--- a/Document-Processing/PDF/PDF-Viewer/blazor/document-security/password-protected.md
+++ b/Document-Processing/PDF/PDF-Viewer/blazor/document-security/password-protected.md
@@ -9,11 +9,7 @@ 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.
+Some PDFs require a password to open. When a protected document is loaded, the viewer displays a password prompt automatically.
**Desktop password prompt:**
@@ -23,45 +19,82 @@ The viewer displays a password prompt UI when a protected document is opened.

-- If the correct password is provided, the document loads and becomes viewable per the document’s permissions.
+The viewer handles the prompt as follows:
+
+- If the correct password is provided, the document loads and becomes viewable according to 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:**
+**Invalid password error in mobile:**

- If the operation is canceled, the document is not loaded.
+## Detect load errors
+
+Handle incorrect-password events through the [`DocumentLoadFailed`](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerEvents.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerEvents_DocumentLoadFailed) event to surface custom error messages.
+
+## Supported permissions
+
+When the document loads successfully, the viewer respects the permissions embedded in the PDF. Common restrictions include:
+
+- Printing allowed or disallowed
+- Content copying
+- Page editing
+- Commenting and annotations
+
+The viewer cannot bypass or elevate document permissions. For the full list of owner-controlled permissions, see [Permission-protected documents](./permission).
+
## 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.
+Use the [`LoadAsync`](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerBase.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerBase_LoadAsync_System_Byte___System_String_) method to load a PDF from a file path, URL, or base64 data at runtime. The two supported overloads are:
+
+- `LoadAsync(byte[] bytes, string password = null)` — pass the PDF as a byte array
+- `LoadAsync(string document, string password = null)` — pass a URL or server-relative path
-```cshtml
+The password parameter is consumed for the current load operation only and is not cached across re-renders. If the document is reloaded, supply the password again.
+```csharp
+@page "/password-protected"
@using Syncfusion.Blazor.SfPdfViewer
@using Syncfusion.Blazor.Buttons
-
Load Document
+
Load Document
-@code{
- SfPdfViewer2 Viewer;
+@code {
+ private SfPdfViewer2? Viewer;
- public async void clicked()
+ private async Task Clicked()
{
+ if (Viewer is null)
+ {
+ return;
+ }
+
await Viewer.LoadAsync("wwwroot/pdf-succinctly-password-protected.pdf", "password");
}
}
-
```
+N> The sample uses a `wwwroot/` path, which is appropriate for Blazor WebAssembly. For Blazor Server, load the file from a server-accessible location (for example, pass a byte array returned from an API) and use the `byte[]` overload.
+
+**Outcomes**
+
+| Password state | Result |
+|---|---|
+| Correct | The PDF loads immediately |
+| Incorrect | The viewer displays the incorrect password popup |
+| Null or empty | The password popup is shown automatically |
+
[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)
\ No newline at end of file
+* [Permission-protected documents](./permission)
+* [Load a Password-Protected PDF in Blazor](../document-handling/load-password-pdf)
diff --git a/Document-Processing/PDF/PDF-Viewer/blazor/document-security/permission.md b/Document-Processing/PDF/PDF-Viewer/blazor/document-security/permission.md
index 19bb1dcd35..cb457b69e5 100644
--- a/Document-Processing/PDF/PDF-Viewer/blazor/document-security/permission.md
+++ b/Document-Processing/PDF/PDF-Viewer/blazor/document-security/permission.md
@@ -9,45 +9,57 @@ 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:
+PDFs can be secured with an owner password and a set of permissions that restrict operations after the file is opened. Common restrictions include:
-- Printing: allowed or disallowed
-- Content copying
-- Page editing
+- Printing (allowed or disallowed)
+- Copying content
+- Editing pages
- 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.
+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 disabled; when copying is restricted, text selection is limited or copy commands are 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.
+Use the [`LoadAsync`](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerBase.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerBase_LoadAsync_System_Byte___System_String_) method to load a PDF from a file path, URL, or base64 data at runtime. The supported overloads are:
-```cshtml
+- `LoadAsync(byte[] bytes, string password = null)` — load the PDF as a byte array
+- `LoadAsync(string document, string password = null)` — load a URL or server-relative path
+- `LoadAsync(Stream stream, string password = null)` — load a PDF Document from the stream.
+```csharp
+@page "/permission-protected"
@using Syncfusion.Blazor.SfPdfViewer
@using Syncfusion.Blazor.Buttons
-
Load Document
-
-
+
+ Load Document
+
+
+
-@code{
- SfPdfViewer2 Viewer;
+@code {
+ private SfPdfViewer2? Viewer;
- public async void clicked()
+ private async Task Clicked()
{
- await Viewer.LoadAsync("wwwroot/permission-protected.pdf", "password");
+ if (Viewer is null)
+ {
+ return;
+ }
+
+ await Viewer.LoadAsync("wwwroot/permission-protected.pdf");
}
}
-
```
-[View sample in GitHub](https://github.com/SyncfusionExamples/blazor-pdf-viewer-examples/tree/master/Load%20and%20Save/Load%20the%20Security%20Document).
+N> [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)
\ No newline at end of file
+* [Password-protected documents](./password-protected)
+* [Getting started with SfPdfViewer2](../getting-started/web-app)
+* [SfPdfViewer2 API reference](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerBase.html)
\ No newline at end of file
diff --git a/Document-Processing/PDF/PDF-Viewer/blazor/images/open-pdf.png b/Document-Processing/PDF/PDF-Viewer/blazor/images/open-pdf.png
new file mode 100644
index 0000000000..f82d0440f3
Binary files /dev/null and b/Document-Processing/PDF/PDF-Viewer/blazor/images/open-pdf.png differ
diff --git a/Document-Processing/PDF/PDF-Viewer/blazor/images/password-popup.png b/Document-Processing/PDF/PDF-Viewer/blazor/images/password-popup.png
new file mode 100644
index 0000000000..2a3a3263c9
Binary files /dev/null and b/Document-Processing/PDF/PDF-Viewer/blazor/images/password-popup.png differ