Skip to content
Open
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
8 changes: 8 additions & 0 deletions Document-Processing-toc.html
Original file line number Diff line number Diff line change
Expand Up @@ -1134,6 +1134,14 @@
<li><a href="/document-processing/pdf/pdf-viewer/blazor/save-pdf-file/to-box-cloud-file-storage">To Box cloud file storage</a></li>
</ul>
</li>
<li>Document Handling
<ul>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/document-handling/load-large-pdf">Load Large PDF Files</a></li>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/document-handling/load-password-pdf">Load Password Protected PDFs</a></li>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/document-handling/preprocess-pdf">Preprocess PDF Document Before Displaying</a></li>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/document-handling/retrieve-loaded-document">Retrieve the Loaded Document Instance </a></li>
</ul>
</li>
<li> <a href="/document-processing/pdf/pdf-viewer/blazor/toolbar-customization-overview">Toolbar Customization</a>
<ul>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/toolbar-customization/primary-toolbar">Primary Toolbar</a></li>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
---
layout: post
title: Document Handling in Blazor PDF Viewer Component | Syncfusion
description: Learn how to load and render large PDF files in the Syncfusion Blazor PDF Viewer using chunk-based processing
control: PDF Viewer
platform: document-processing
documentation: ug
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.

Large PDF rendering in the Blazor PDF Viewer is supported through **chunk-based processing**, which allows the document to be processed incrementally instead of downloading and rendering the entire file in a single request.

## Why Large PDFs Require Special Handling

Large PDF files may contain:

- High‑resolution images
- Compressed streams
- Digital signatures
- Form fields and annotations
- Vector graphics and complex page layouts

Loading and processing such files in a single request can cause high memory usage and browser limitations. Chunk-based processing ensures the document is streamed and rendered progressively, improving reliability and performance.

## Viewer Capability Overview

With proper configuration, the Blazor PDF Viewer can:

- Render large PDF files up to **~1 GB**
- Load and process documents incrementally using chunks
- Improve page navigation and scrolling responsiveness
- Reduce memory pressure on the browser

N> Large PDF support depends on enabling chunk-based processing 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

Chunk-based processing is **mandatory** for loading large PDF files in the Blazor PDF Viewer. It allows the document to be processed in smaller byte ranges instead of transferring the entire file at once.

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)

Ensure that:

- The server supports **HTTP range requests**
- Chunk processing is enabled as documented
- Connection buffer limits are configured correctly

### 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
- Improve stability and loading behavior for large files

This approach is suitable for PDFs hosted on servers, secured APIs, or cloud storage endpoints.

---

### 3. Optimize Network and Performance Configuration

Proper network configuration plays a critical role in rendering large PDFs.

#### Increase Connection Buffer Size

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)

#### Use CDN for Improved Performance

Using CDN resources reduces script download time and improves viewer initialization performance:

- [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:

- Close unused applications
- Minimize open browser tabs
- Avoid running multiple heavy tasks in parallel
- Do not open multiple large PDFs at the same time

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)
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
---
layout: post
title: Load Password Protected PDFs in Blazor PDF Viewer | Syncfusion
description: Learn how to open password-protected PDF files in the Syncfusion Blazor PDF Viewer by providing the password in the documentPath object.
control: PDF Viewer
platform: document-processing
documentation: ug
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.

## 1. 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:

- The viewer detects that the document is encrypted

![Open PDF Document](../../react/images/open-pdf.png)

- A **password input popup** is automatically displayed

![Password Protected Pop-up](../../react/images/password-popup.png)

- The user enters the password

- The document is decrypted and loaded

No additional configuration or code is required.

This approach works for all password-protected PDFs opened locally by the user.

## 2. Opening a Password-Protected PDF Programmatically

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.

### 2.1 Load the Document Using `LoadAsync(byte[] bytes, string password = null)`

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:

```cs
@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");
}
}
```

- 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

This is useful when the password is known beforehand.

### 2.2 Loading a Password-Protected Document's URL Using `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:

```cs
@using Syncfusion.Blazor
@using Syncfusion.Blazor.SfPdfViewer

<SfPdfViewer2 DocumentPath="@DocumentPath"
Height="100%"
Width="100%">
</SfPdfViewer2>

@code {
//Load URL for Passwrod-Protected Document in DocumentPath
public string DocumentPath { get; set; } = "https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf";
}
```

The viewer will:

- Detect encryption
- Show the **password popup automatically**
- Allow the user to enter the correct password
- Then load the PDF

![Password Protected Pop-up](../../react/images/password-popup.png)

N> No password should be passed inside `documentPath`.
Loading