跳過到頁腳內容
USING IRONPDF

How to Display a PDF in Blazor

要在 Blazor 應用程式中顯示 PDF,請使用 IronPDF 的 PDF 檢視器元件,該元件與 Blazor Server 應用程式無縫集成,提供高效能的 PDF 渲染,並具有表單填寫、註釋和行動支援等功能,而無需第三方瀏覽器工具。

為什麼我需要在 Blazor 中使用 PDF 檢視器元件?

在現代 Web 應用程式中顯示 PDF 需要一個可靠的檢視器元件,該元件的功能超越了瀏覽器的基本功能。 對於建立 Blazor 應用程式的 .NET 開發人員來說, IronPDF提供了一個有效的PDF 檢視器解決方案,可與您的Blazor Server 應用程式無縫整合。 這樣,您無需依賴第三方瀏覽器工具,即可高效能、高功能地顯示 PDF 文件。

在本教程中,我們將探索如何使用 IronPDF 實現 Blazor PDF 檢視器,建立一個PDF 檢視器元件,該元件可以開啟 PDF 檔案、處理PDF 內容,並為使用者提供直覺的介面,以便在桌面和行動裝置上顯示 PDF。 Chrome渲染引擎確保跨平台顯示效果一致。

考慮到瀏覽器的局限性,使用專用 PDF 檢視器元件的必要性就顯而易見了。 不同瀏覽器和平台對原生瀏覽器 PDF 的支援程度差異很大,導致使用者體驗不一致。 透過在 Blazor 應用程式中實作自訂 PDF 檢視器,您可以完全控制檢視體驗,確保在所有平台上實現一致的功能。 對於需要符合合規標準安全功能的應用程式而言,這一點尤其重要。

如何使用 IronPDF 顯示 PDF 檔案?

在實作 Blazor PDF 檢視器之前,您需要安裝 IronPDF。 透過NuGet將其新增至您的 Blazor Server 應用程式:

Install-Package IronPdf

接下來,建立一個新的 Blazor 應用程序,並確保已安裝最新版本的 .NET Core。 將您的 PDF 文件儲存在 wwwroot 資料夾中以便輕鬆訪問,或準備從其他來源(如位元組數組或 URL)加載它們。 安裝概述部分提供了各種部署場景的詳細指導。

我需要哪些先決條件?

若要成功實作 Blazor PDF 檢視器,請確保您已具備以下條件:

  • 您的開發機器上已安裝.NET 6.0 或更高版本
  • Visual Studio 2022或具有 C# 擴充功能的 Visual Studio Code
  • IronPDF 許可證金鑰(您可以先免費試用
  • Blazor 組件結構有基本的了解
  • 用於測試的範例 PDF 檔案(請將其放在 wwwroot 資料夾中)

對於Windows 部署,請確保您擁有適當的Visual C++ 執行階段環境Linux 用戶應安裝所需的依賴項,而macOS 開發人員需要考慮 Intel 晶片與 Apple Silicon 晶片的兼容性。

我應該把PDF文件保存在哪裡?

PDF 檔案儲存位置對應用程式的效能安全性有顯著影響。 對於 Blazor 應用程序,請考慮以下選項:

  • wwwroot 資料夾:非常適合存放不含敏感資訊的靜態 PDF 檔案。 Azure Blob 儲存:非常適合需要靈活儲存的雲端應用程式 -資料庫以位元組數組形式儲存:適用於需要存取控制的小型 PDF 文件 -受保護的伺服器目錄:最適合存放有安全要求的敏感文檔 -記憶體流:最適合使用HTML 轉 PDF動態產生 PDF

對於Docker 部署,請考慮容器化儲存解決方案AWS Lambda 使用者應實施適當的記憶體管理

如何建立我的第一個 Blazor PDF 檢視器元件?

讓我們建立一個基本的 Blazor PDF 檢視器元件,它可以顯示 PDF 文件。 首先,建立一個新的 Razor 元件:

@page "/pdfviewer"
@rendermode InteractiveServer
@using IronPdf
@inject IJSRuntime JSRuntime
@inject Microsoft.AspNetCore.Hosting.IWebHostEnvironment WebHostEnvironment
<h3>PDF Viewer Component</h3>
<div>
    <button @onclick="LoadPdfDocument">Open File</button>
    <div id="pdfContainer">
        @if (!string.IsNullOrEmpty(pdfUrl))
        {
            <iframe src="@pdfUrl" style="width:100%; height:600px;"></iframe>
        }
    </div>
</div>
@code {
    private string pdfUrl = "";
    private byte[] pdfData;
    private async Task LoadPdfDocument()
    {
        // Load PDF from file
        var pdfDocument = PdfDocument.FromFile("wwwroot/sample.pdf");
        pdfData = pdfDocument.BinaryData;
        // Create object URL for display
        pdfUrl = await CreateObjectUrl(pdfData);
    }
    private async Task<string> CreateObjectUrl(byte[] data)
    {
        var base64 = Convert.ToBase64String(data);
        return $"data:application/pdf;base64,{base64}";
    }
}
@page "/pdfviewer"
@rendermode InteractiveServer
@using IronPdf
@inject IJSRuntime JSRuntime
@inject Microsoft.AspNetCore.Hosting.IWebHostEnvironment WebHostEnvironment
<h3>PDF Viewer Component</h3>
<div>
    <button @onclick="LoadPdfDocument">Open File</button>
    <div id="pdfContainer">
        @if (!string.IsNullOrEmpty(pdfUrl))
        {
            <iframe src="@pdfUrl" style="width:100%; height:600px;"></iframe>
        }
    </div>
</div>
@code {
    private string pdfUrl = "";
    private byte[] pdfData;
    private async Task LoadPdfDocument()
    {
        // Load PDF from file
        var pdfDocument = PdfDocument.FromFile("wwwroot/sample.pdf");
        pdfData = pdfDocument.BinaryData;
        // Create object URL for display
        pdfUrl = await CreateObjectUrl(pdfData);
    }
    private async Task<string> CreateObjectUrl(byte[] data)
    {
        var base64 = Convert.ToBase64String(data);
        return $"data:application/pdf;base64,{base64}";
    }
}
Imports IronPdf
Imports Microsoft.AspNetCore.Hosting
Imports Microsoft.AspNetCore.Components
Imports Microsoft.JSInterop

@page "/pdfviewer"
@rendermode InteractiveServer

@inject IJSRuntime JSRuntime
@inject IWebHostEnvironment WebHostEnvironment

<h3>PDF Viewer Component</h3>
<div>
    <button @onclick="LoadPdfDocument">Open File</button>
    <div id="pdfContainer">
        @If Not String.IsNullOrEmpty(pdfUrl) Then
            <iframe src="@pdfUrl" style="width:100%; height:600px;"></iframe>
        End If
    </div>
</div>

@code
    Private pdfUrl As String = ""
    Private pdfData As Byte()

    Private Async Function LoadPdfDocument() As Task
        ' Load PDF from file
        Dim pdfDocument = PdfDocument.FromFile("wwwroot/sample.pdf")
        pdfData = pdfDocument.BinaryData
        ' Create object URL for display
        pdfUrl = Await CreateObjectUrl(pdfData)
    End Function

    Private Async Function CreateObjectUrl(data As Byte()) As Task(Of String)
        Dim base64 = Convert.ToBase64String(data)
        Return $"data:application/pdf;base64,{base64}"
    End Function
End Code
$vbLabelText   $csharpLabel

這段程式碼創建了一個簡單的 PDF 檢視器元件,該元件會載入PDF 文件並使用 iframe 顯示它。 LoadPdfDocument方法從 wwwroot 資料夾讀取 PDF 檔案並將其轉換為位元組數組。 CreateObjectUrl方法隨後將此位元組陣列轉換為 iframe 可以顯示的資料 URL,從而允許使用者查看已載入的 PDF 文件。 這種方法適用於各種 PDF 版本,並支援UTF-8 編碼

組件如何載入 PDF 文件?

此元件利用IronPDF 的文件載入功能有效率地讀取 PDF 文件。 當使用者點擊"開啟檔案"按鈕時, LoadPdfDocument方法:

  1. 使用PdfDocument.FromFile載入 PDF 文件
  2. 從載入的 PDF 文件中提取二進位數據 3.轉換為 Base64格式以相容瀏覽器。 4.建立瀏覽器可以直接渲染的資料 URL

這種方法既能確保在不同瀏覽器上的相容性,又能保持 PDF 顯示的高效能。 此組件可以處理各種紙張尺寸頁面方向

顯示 PDF 文件時常見的問題有哪些?

在 Blazor 中實作 PDF 檢視器時,開發人員經常會遇到以下挑戰:

如需排查特定問題,請查閱快速故障排除指南聯絡工程支援

輸出

! Blazor PDF 檢視器元件的螢幕截圖,顯示了一個包含"什麼是 PDF?"內容的範例 PDF,其中顯示了導航控制項、縮放選項和"開啟檔案"按鈕。

如何實作 JavaScript 互通以改善顯示效果?

為了更好地控制PDF內容的顯示,我們可以使用JavaScript函數來處理PDF檢視器的功能:

@page "/pdf-jsinterop"
@rendermode InteractiveServer
@using IronPdf
@inject IJSRuntime JSRuntime
@inject Microsoft.AspNetCore.Hosting.IWebHostEnvironment WebHostEnvironment
<h3>IronPDF JavaScript Interop Viewer</h3>
<p>Displays PDF using JavaScript's Blob/ObjectURL capabilities.</p>
@if (!string.IsNullOrEmpty(ErrorMessage))
{
    <div class="alert alert-danger">Error: @ErrorMessage</div>
}
<div id="@documentId" style="border: 1px solid #ccc; width: 100%; min-height: 600px;">
    Loading PDF...
</div>
@code {
    private string documentId = Guid.NewGuid().ToString();
    private string ErrorMessage = string.Empty;
    private bool pdfLoaded = false;
    // Hold the reference to the loaded JavaScript module
    private IJSObjectReference? jsModule;
    protected override async Task OnAfterRenderAsync(bool firstRender)
    {
        if (firstRender && !pdfLoaded)
        {
            try
            {
                // 1. Asynchronously load the JavaScript file as a module
                // This guarantees the script is loaded before the next line executes.
                jsModule = await JSRuntime.InvokeAsync<IJSObjectReference>("import",
                    "./pdfViewerInterop.js");
                await LoadPdfWithJavaScript();
                pdfLoaded = true;
            }
            catch (Exception ex)
            {
                ErrorMessage = $"Failed to load JS module or execute: {ex.Message}";
            }
            finally
            {
                StateHasChanged();
            }
        }
    }
    private async Task LoadPdfWithJavaScript()
    {
        if (jsModule is null) return; // Should never happen if the module loads successfully
        try
        {
            var pdfPath = Path.Combine(WebHostEnvironment.WebRootPath, "sample.pdf");
            if (!File.Exists(pdfPath))
            {
                ErrorMessage = $"File not found: {pdfPath}";
                return;
            }
            var pdf = PdfDocument.FromFile(pdfPath);
            var stream = new MemoryStream(pdf.BinaryData);
            // 2. Invoke the function using the module reference
            // Note: We only pass the function name here.
            await jsModule.InvokeVoidAsync("displayPdf",
                documentId, stream.ToArray());
        }
        catch (Exception ex)
        {
            ErrorMessage = $"Failed to load PDF or invoke JS: {ex.Message}";
        }
    }
    // IMPORTANT: Dispose of the module when the component is removed
    public async ValueTask DisposeAsync()
    {
        if (jsModule is not null)
        {
            await jsModule.DisposeAsync();
        }
    }
}
@page "/pdf-jsinterop"
@rendermode InteractiveServer
@using IronPdf
@inject IJSRuntime JSRuntime
@inject Microsoft.AspNetCore.Hosting.IWebHostEnvironment WebHostEnvironment
<h3>IronPDF JavaScript Interop Viewer</h3>
<p>Displays PDF using JavaScript's Blob/ObjectURL capabilities.</p>
@if (!string.IsNullOrEmpty(ErrorMessage))
{
    <div class="alert alert-danger">Error: @ErrorMessage</div>
}
<div id="@documentId" style="border: 1px solid #ccc; width: 100%; min-height: 600px;">
    Loading PDF...
</div>
@code {
    private string documentId = Guid.NewGuid().ToString();
    private string ErrorMessage = string.Empty;
    private bool pdfLoaded = false;
    // Hold the reference to the loaded JavaScript module
    private IJSObjectReference? jsModule;
    protected override async Task OnAfterRenderAsync(bool firstRender)
    {
        if (firstRender && !pdfLoaded)
        {
            try
            {
                // 1. Asynchronously load the JavaScript file as a module
                // This guarantees the script is loaded before the next line executes.
                jsModule = await JSRuntime.InvokeAsync<IJSObjectReference>("import",
                    "./pdfViewerInterop.js");
                await LoadPdfWithJavaScript();
                pdfLoaded = true;
            }
            catch (Exception ex)
            {
                ErrorMessage = $"Failed to load JS module or execute: {ex.Message}";
            }
            finally
            {
                StateHasChanged();
            }
        }
    }
    private async Task LoadPdfWithJavaScript()
    {
        if (jsModule is null) return; // Should never happen if the module loads successfully
        try
        {
            var pdfPath = Path.Combine(WebHostEnvironment.WebRootPath, "sample.pdf");
            if (!File.Exists(pdfPath))
            {
                ErrorMessage = $"File not found: {pdfPath}";
                return;
            }
            var pdf = PdfDocument.FromFile(pdfPath);
            var stream = new MemoryStream(pdf.BinaryData);
            // 2. Invoke the function using the module reference
            // Note: We only pass the function name here.
            await jsModule.InvokeVoidAsync("displayPdf",
                documentId, stream.ToArray());
        }
        catch (Exception ex)
        {
            ErrorMessage = $"Failed to load PDF or invoke JS: {ex.Message}";
        }
    }
    // IMPORTANT: Dispose of the module when the component is removed
    public async ValueTask DisposeAsync()
    {
        if (jsModule is not null)
        {
            await jsModule.DisposeAsync();
        }
    }
}
Imports System
Imports System.IO
Imports System.Threading.Tasks
Imports IronPdf
Imports Microsoft.AspNetCore.Components
Imports Microsoft.AspNetCore.Components.Web
Imports Microsoft.JSInterop
Imports Microsoft.AspNetCore.Hosting

@page "/pdf-jsinterop"
@rendermode InteractiveServer

@inject IJSRuntime JSRuntime
@inject IWebHostEnvironment WebHostEnvironment

<h3>IronPDF JavaScript Interop Viewer</h3>
<p>Displays PDF using JavaScript's Blob/ObjectURL capabilities.</p>
@if Not String.IsNullOrEmpty(ErrorMessage) Then
    <div class="alert alert-danger">Error: @ErrorMessage</div>
End If
<div id="@documentId" style="border: 1px solid #ccc; width: 100%; min-height: 600px;">
    Loading PDF...
</div>

@code
    Private documentId As String = Guid.NewGuid().ToString()
    Private ErrorMessage As String = String.Empty
    Private pdfLoaded As Boolean = False
    ' Hold the reference to the loaded JavaScript module
    Private jsModule As IJSObjectReference

    Protected Overrides Async Function OnAfterRenderAsync(firstRender As Boolean) As Task
        If firstRender AndAlso Not pdfLoaded Then
            Try
                ' 1. Asynchronously load the JavaScript file as a module
                ' This guarantees the script is loaded before the next line executes.
                jsModule = Await JSRuntime.InvokeAsync(Of IJSObjectReference)("import", "./pdfViewerInterop.js")
                Await LoadPdfWithJavaScript()
                pdfLoaded = True
            Catch ex As Exception
                ErrorMessage = $"Failed to load JS module or execute: {ex.Message}"
            Finally
                StateHasChanged()
            End Try
        End If
    End Function

    Private Async Function LoadPdfWithJavaScript() As Task
        If jsModule Is Nothing Then Return ' Should never happen if the module loads successfully
        Try
            Dim pdfPath = Path.Combine(WebHostEnvironment.WebRootPath, "sample.pdf")
            If Not File.Exists(pdfPath) Then
                ErrorMessage = $"File not found: {pdfPath}"
                Return
            End If
            Dim pdf = PdfDocument.FromFile(pdfPath)
            Dim stream = New MemoryStream(pdf.BinaryData)
            ' 2. Invoke the function using the module reference
            ' Note: We only pass the function name here.
            Await jsModule.InvokeVoidAsync("displayPdf", documentId, stream.ToArray())
        Catch ex As Exception
            ErrorMessage = $"Failed to load PDF or invoke JS: {ex.Message}"
        End Try
    End Function

    ' IMPORTANT: Dispose of the module when the component is removed
    Public Async Function DisposeAsync() As ValueTask Implements IAsyncDisposable.DisposeAsync
        If jsModule IsNot Nothing Then
            Await jsModule.DisposeAsync()
        End If
    End Function
End Code
$vbLabelText   $csharpLabel

將此 JavaScript 函數新增至 wwwroot 資料夾中的 JavaScript 檔案:

export function displayPdf(elementId, data) {
    // 1. Create a Blob from the byte array data
    const blob = new Blob([new Uint8Array(data)],
        { type: 'application/pdf' });
    // 2. Create a temporary URL for the Blob
    const url = URL.createObjectURL(blob);
    // 3. Find the container element
    const container = document.getElementById(elementId);
    if (!container) return;
    // 4. Clear any previous content
    container.innerHTML = '';
    // 5. Create and configure the iframe
    const iframe = document.createElement('iframe');
    iframe.src = url;
    iframe.style.width = '100%';
    iframe.style.height = '600px';
    iframe.style.border = 'none';
    // 6. Append the iframe to the container
    container.appendChild(iframe);
}
export function displayPdf(elementId, data) {
    // 1. Create a Blob from the byte array data
    const blob = new Blob([new Uint8Array(data)],
        { type: 'application/pdf' });
    // 2. Create a temporary URL for the Blob
    const url = URL.createObjectURL(blob);
    // 3. Find the container element
    const container = document.getElementById(elementId);
    if (!container) return;
    // 4. Clear any previous content
    container.innerHTML = '';
    // 5. Create and configure the iframe
    const iframe = document.createElement('iframe');
    iframe.src = url;
    iframe.style.width = '100%';
    iframe.style.height = '600px';
    iframe.style.border = 'none';
    // 6. Append the iframe to the container
    container.appendChild(iframe);
}
The provided code is JavaScript, not C#. Therefore, it cannot be directly converted to VB.NET. However, if you have a C# code snippet that you would like to convert to VB.NET, please provide it, and I will assist you with the conversion.
$vbLabelText   $csharpLabel

此 JavaScript 函數從 PDF 資料建立一個 blob,並產生一個物件 URL。 然後,它會動態建立一個 iframe 元素並將其新增到容器中。 這種方法可以讓你更能控制PDF 頁面的顯示方式,並更好地管理 PDF 檢視器元件的生命週期。 該技術支援JavaScript 渲染和複雜文件的自訂渲染延遲

為什麼我應該使用 JavaScript 互通而不是直接顯示?

JavaScript 互通為 Blazor 中的PDF 渲染提供了幾個優勢:

這種互通方法還支援自訂 JavaScript 執行訊息監聽器,以適應進階場景。

JavaScript 互通何時能提升效能?

在以下情況下,JavaScript 互通性可顯著提高效能

對於批次操作,可考慮使用平行處理;對於並發生成 PDF,可考慮使用多執行緒

如何處理 JavaScript 錯誤?

妥善的錯誤處理機制可確保可靠的PDF檢視體驗。 實施以下策略:

try {
    // Check if the browser supports required features
    if (!window.Blob || !window.URL) {
        throw new Error("Browser doesn't support required PDF viewing features");
    }
    // Validate PDF data before processing
    if (!data || data.length === 0) {
        throw new Error("Invalid PDF data received");
    }
    // Monitor memory usage for large files
    if (data.length > 50 * 1024 * 1024) { // 50MB threshold
        console.warn("Large PDF detected, performance may be affected");
    }
} catch (error) {
    console.error("PDF viewing error:", error);
    // Fallback to server-side rendering
}
try {
    // Check if the browser supports required features
    if (!window.Blob || !window.URL) {
        throw new Error("Browser doesn't support required PDF viewing features");
    }
    // Validate PDF data before processing
    if (!data || data.length === 0) {
        throw new Error("Invalid PDF data received");
    }
    // Monitor memory usage for large files
    if (data.length > 50 * 1024 * 1024) { // 50MB threshold
        console.warn("Large PDF detected, performance may be affected");
    }
} catch (error) {
    console.error("PDF viewing error:", error);
    // Fallback to server-side rendering
}
Try
    ' Check if the browser supports required features
    If Not window.Blob OrElse Not window.URL Then
        Throw New Exception("Browser doesn't support required PDF viewing features")
    End If
    ' Validate PDF data before processing
    If data Is Nothing OrElse data.length = 0 Then
        Throw New Exception("Invalid PDF data received")
    End If
    ' Monitor memory usage for large files
    If data.length > 50 * 1024 * 1024 Then ' 50MB threshold
        Console.Warn("Large PDF detected, performance may be affected")
    End If
Catch error As Exception
    Console.Error.WriteLine("PDF viewing error: " & error.ToString())
    ' Fallback to server-side rendering
End Try
$vbLabelText   $csharpLabel

為了實現完整的錯誤跟踪,請實施自訂日誌記錄並監控渲染逾時

輸出

IronPDF JavaScript 互通檢視器介面顯示了一個 PDF 文檔,其中包含"什麼是 PDF?"的內容,示範了 JavaScript Blob/ObjectURL PDF 渲染功能。

如何從不同來源載入PDF文件?

Blazor PDF 檢視器可以從各種來源檢索和顯示 PDF 文件:

private async Task LoadFromUrl()
{
    var client = new HttpClient();
    var response = await client.GetAsync("___PROTECTED_URL_116___");
    var stream = await response.Content.ReadAsStreamAsync();
    var pdfDocument = new PdfDocument(stream);
    await DisplayPdfContent(pdfDocument);
}
private async Task LoadFromHtmlContent()
{
    var renderer = new ChromePdfRenderer();
    var htmlContent = "<h1>Generated PDF</h1>";
    var pdfDocument = renderer.RenderHtmlAsPdf(htmlContent);
    await DisplayPdfContent(pdfDocument);
}
private async Task DisplayPdfContent(PdfDocument document)
{
    var data = document.BinaryData;
    pdfUrl = $"data:application/pdf;base64,{Convert.ToBase64String(data)}";
}
private async Task LoadFromUrl()
{
    var client = new HttpClient();
    var response = await client.GetAsync("___PROTECTED_URL_116___");
    var stream = await response.Content.ReadAsStreamAsync();
    var pdfDocument = new PdfDocument(stream);
    await DisplayPdfContent(pdfDocument);
}
private async Task LoadFromHtmlContent()
{
    var renderer = new ChromePdfRenderer();
    var htmlContent = "<h1>Generated PDF</h1>";
    var pdfDocument = renderer.RenderHtmlAsPdf(htmlContent);
    await DisplayPdfContent(pdfDocument);
}
private async Task DisplayPdfContent(PdfDocument document)
{
    var data = document.BinaryData;
    pdfUrl = $"data:application/pdf;base64,{Convert.ToBase64String(data)}";
}
Private Async Function LoadFromUrl() As Task
    Dim client = New HttpClient()
    Dim response = Await client.GetAsync("___PROTECTED_URL_116___")
    Dim stream = Await response.Content.ReadAsStreamAsync()
    Dim pdfDocument = New PdfDocument(stream)
    Await DisplayPdfContent(pdfDocument)
End Function

Private Async Function LoadFromHtmlContent() As Task
    Dim renderer = New ChromePdfRenderer()
    Dim htmlContent = "<h1>Generated PDF</h1>"
    Dim pdfDocument = renderer.RenderHtmlAsPdf(htmlContent)
    Await DisplayPdfContent(pdfDocument)
End Function

Private Async Function DisplayPdfContent(document As PdfDocument) As Task
    Dim data = document.BinaryData
    pdfUrl = $"data:application/pdf;base64,{Convert.ToBase64String(data)}"
End Function
$vbLabelText   $csharpLabel

這些方法示範如何使用 HTTPS 從 URL 載入 PDF 檔案、如何將 HTML 內容轉換為 PDF以及如何顯示產生的 PDF 內容。 LoadFromUrl方法從遠端位置檢索 PDF 文檔,而LoadFromHtmlContent展示瞭如何動態地將 HTML 轉換為 PDF ,從而為 Blazor PDF 檢視器元件獲取其內容的方式提供了靈活性。 Chrome渲染引擎確保轉換準確。

其他資訊來源包括:

考慮將 DOCX 轉換為 PDF以用於 Microsoft Word 文檔,並將圖像轉換為 PDF以用於照片存檔。

我應該選擇哪種資料來源?

請根據以下因素選擇您的PDF來源:

來源類型 最適合 表現 安全
本地文件 靜態內容 出色的 低的
網址 外部文件 好的 中等的
HTML轉換 動態報表 多變的 高的
BLOB 存儲 企業應用 出色的 高的
記憶體流 臨時PDF 出色的 高的

對於HTML 檔案轉換,請考慮使用基本 URL以正確載入資源。 ZIP 檔案來源提供捆綁內容選項。

從 URL 載入時如何處理網路錯誤?

實現基於URL的PDF載入的可靠錯誤處理:

private async Task<PdfDocument> LoadFromUrlWithRetry(string url, int maxRetries = 3)
{
    for (int i = 0; i < maxRetries; i++)
    {
        try
        {
            using var client = new HttpClient();
            client.Timeout = TimeSpan.FromSeconds(30);

            var response = await client.GetAsync(url);
            response.EnsureSuccessStatusCode();

            var stream = await response.Content.ReadAsStreamAsync();
            return new PdfDocument(stream);
        }
        catch (HttpRequestException ex) when (i < maxRetries - 1)
        {
            await Task.Delay(TimeSpan.FromSeconds(Math.Pow(2, i))); // Exponential backoff
        }
    }
    throw new Exception($"Failed to load PDF from {url} after {maxRetries} attempts");
}
private async Task<PdfDocument> LoadFromUrlWithRetry(string url, int maxRetries = 3)
{
    for (int i = 0; i < maxRetries; i++)
    {
        try
        {
            using var client = new HttpClient();
            client.Timeout = TimeSpan.FromSeconds(30);

            var response = await client.GetAsync(url);
            response.EnsureSuccessStatusCode();

            var stream = await response.Content.ReadAsStreamAsync();
            return new PdfDocument(stream);
        }
        catch (HttpRequestException ex) when (i < maxRetries - 1)
        {
            await Task.Delay(TimeSpan.FromSeconds(Math.Pow(2, i))); // Exponential backoff
        }
    }
    throw new Exception($"Failed to load PDF from {url} after {maxRetries} attempts");
}
Imports System
Imports System.Net.Http
Imports System.Threading.Tasks

Private Async Function LoadFromUrlWithRetry(url As String, Optional maxRetries As Integer = 3) As Task(Of PdfDocument)
    For i As Integer = 0 To maxRetries - 1
        Try
            Using client As New HttpClient()
                client.Timeout = TimeSpan.FromSeconds(30)

                Dim response = Await client.GetAsync(url)
                response.EnsureSuccessStatusCode()

                Dim stream = Await response.Content.ReadAsStreamAsync()
                Return New PdfDocument(stream)
            End Using
        Catch ex As HttpRequestException When i < maxRetries - 1
            Await Task.Delay(TimeSpan.FromSeconds(Math.Pow(2, i))) ' Exponential backoff
        End Try
    Next
    Throw New Exception($"Failed to load PDF from {url} after {maxRetries} attempts")
End Function
$vbLabelText   $csharpLabel

對於已認證的來源,實作HTTP請求標頭並處理TLS登入。 考慮使用cookie 管理基於會話的存取。

HTML 轉換 PDF 轉換在什麼情況下最有用?

HTML 轉 PDF在以下情況下表現優異:

使用CSS 支援實現響應式設計,並使用Web 字體實現一致的排版。

使用 HTML 內容輸出

IronPDF 測試介面示範如何成功地從 HTML 內容產生 PDF,頂部顯示了從 URL 載入或從 HTML 產生的選項。

如何為我的PDF閱讀器新增互動功能?

透過互動式功能改進您的 PDF 檢視器:

@code {
    private int currentPage = 1;
    private int totalPages;
    private string rotationClass = "";
    private async Task NavigateToPage(int page)
    {
        currentPage = page;
        await JSRuntime.InvokeVoidAsync("navigateTo", page);
    }
    private void RotateCounterclockwise()
    {
        // Counterclockwise switch orientation
        rotationClass = "rotate-270";
    }
    private async Task PrintPdf()
    {
        await JSRuntime.InvokeVoidAsync("printDocument", documentId);
    }
    private async Task DownloadPdf()
    {
        var fileName = "document.pdf";
        await JSRuntime.InvokeVoidAsync("downloadFile", 
           pdfData, fileName);
    }
}
@code {
    private int currentPage = 1;
    private int totalPages;
    private string rotationClass = "";
    private async Task NavigateToPage(int page)
    {
        currentPage = page;
        await JSRuntime.InvokeVoidAsync("navigateTo", page);
    }
    private void RotateCounterclockwise()
    {
        // Counterclockwise switch orientation
        rotationClass = "rotate-270";
    }
    private async Task PrintPdf()
    {
        await JSRuntime.InvokeVoidAsync("printDocument", documentId);
    }
    private async Task DownloadPdf()
    {
        var fileName = "document.pdf";
        await JSRuntime.InvokeVoidAsync("downloadFile", 
           pdfData, fileName);
    }
}
Imports System.Threading.Tasks

Private currentPage As Integer = 1
Private totalPages As Integer
Private rotationClass As String = ""

Private Async Function NavigateToPage(page As Integer) As Task
    currentPage = page
    Await JSRuntime.InvokeVoidAsync("navigateTo", page)
End Function

Private Sub RotateCounterclockwise()
    ' Counterclockwise switch orientation
    rotationClass = "rotate-270"
End Sub

Private Async Function PrintPdf() As Task
    Await JSRuntime.InvokeVoidAsync("printDocument", documentId)
End Function

Private Async Function DownloadPdf() As Task
    Dim fileName As String = "document.pdf"
    Await JSRuntime.InvokeVoidAsync("downloadFile", pdfData, fileName)
End Function
$vbLabelText   $csharpLabel

這段程式碼增加了PDF 頁面之間的導航、旋轉功能(包括逆時針旋轉)以及列印 PDF 的功能。 下載功能允許使用者將 PDF 檔案儲存到本機。 這些功能將您的基本 PDF 檢視器轉變為一個高效的檢視器,內建工具列,為處理 PDF 文件的使用者提供基本功能。 建議新增頁碼書籤,方便導航。

用戶最期待哪些功能?

現代PDF閱讀器應包含以下基本功能:

進階功能可能包括文字擷取影像擷取PDF 轉 HTML 轉換

如何有效率地實現頁面導航?

高效率的頁面導航需要改進渲染效果

private async Task<string> RenderSpecificPage(int pageNumber)
{
    var pdfDocument = PdfDocument.FromFile("document.pdf");
    // Extract single page for faster rendering
    var singlePagePdf = pdfDocument.CopyPage(pageNumber - 1);

    // Convert to image for preview
    var imageData = singlePagePdf.RasterizeToImageFiles("preview_*.png", 150);

    return Convert.ToBase64String(imageData[0]);
}
private async Task<string> RenderSpecificPage(int pageNumber)
{
    var pdfDocument = PdfDocument.FromFile("document.pdf");
    // Extract single page for faster rendering
    var singlePagePdf = pdfDocument.CopyPage(pageNumber - 1);

    // Convert to image for preview
    var imageData = singlePagePdf.RasterizeToImageFiles("preview_*.png", 150);

    return Convert.ToBase64String(imageData[0]);
}
Private Async Function RenderSpecificPage(pageNumber As Integer) As Task(Of String)
    Dim pdfDocument = PdfDocument.FromFile("document.pdf")
    ' Extract single page for faster rendering
    Dim singlePagePdf = pdfDocument.CopyPage(pageNumber - 1)

    ' Convert to image for preview
    Dim imageData = singlePagePdf.RasterizeToImageFiles("preview_*.png", 150)

    Return Convert.ToBase64String(imageData(0))
End Function
$vbLabelText   $csharpLabel

對於大型文檔,請實施分頁符號並考慮拆分 PDF以提高效能。 使用縮圖進行視覺導航。

下載功能的最佳實務是什麼?

實現安全便捷的下載功能

-對檔案名稱進行清理,以防止安全問題 -添加元資料以更好地組織

  • 對大檔案實現壓縮 -追蹤下載量以進行分析
  • 如有需要,可添加浮水印 -設定適當的權限

考慮滿足存檔需求的PDF/A 合規性要求和滿足可訪問性的PDF/UA合規性要求。

輸出

這是一個功能齊全的 PDF 檢視器元件,採用 Blazor 構建,顯示文件導航控制項、100% 縮放功能以及自訂操作按鈕,包括"載入 PDF 檔案"、"列印"、"下載"和"旋轉"選項。

如何處理PDF表單的填寫和註解?

對於帶有表單欄位註釋的PDF 文檔,IronPDF 提供可靠的支援:

private async Task ProcessFormFields(
{
    var pdfDocument = PdfDocument.FromFile("form.pdf");
    foreach (var field in pdfDocument.Form.Fields)
    {
        if (field.Type == PdfFormFieldType.Text)
        {
            field.Value = "User Input";
        }
    }
    // Enable form filling in viewer
    var modifiedPdf = pdfDocument.BinaryData;
    await DisplayPdfContent(pdfDocument);
}
private async Task ProcessFormFields(
{
    var pdfDocument = PdfDocument.FromFile("form.pdf");
    foreach (var field in pdfDocument.Form.Fields)
    {
        if (field.Type == PdfFormFieldType.Text)
        {
            field.Value = "User Input";
        }
    }
    // Enable form filling in viewer
    var modifiedPdf = pdfDocument.BinaryData;
    await DisplayPdfContent(pdfDocument);
}
Option Strict On



Private Async Function ProcessFormFields() As Task
    Dim pdfDocument = PdfDocument.FromFile("form.pdf")
    For Each field In pdfDocument.Form.Fields
        If field.Type = PdfFormFieldType.Text Then
            field.Value = "User Input"
        End If
    Next
    ' Enable form filling in viewer
    Dim modifiedPdf = pdfDocument.BinaryData
    Await DisplayPdfContent(pdfDocument)
End Function
$vbLabelText   $csharpLabel

這樣,您就可以在 Blazor PDF 檢視器元件中啟用表單填寫功能,允許使用者直接在瀏覽器中與表單欄位互動。 該程式碼遍歷 PDF 文件中的表單字段,並能以程式設計方式設定值,因此非常適合需要動態表單填入的應用程式。 支援的功能包括數位簽章文字註釋

我可以支援哪些類型的表單欄位?

IronPDF 支援所有表單欄位類型

  • 用於使用者輸入和資料錄入的文字字段
  • 用於布林選擇的複選框
  • 用於互斥選擇的單選按鈕
  • 預定義選項的下拉列表
  • 用於身份驗證的數位簽名字段
  • 用於評論的多行文字區域
  • 時間資料的日期選擇器

高級功能包括用於企業安全的HSM 簽名版本歷史記錄追蹤。

如何儲存使用者輸入的表單資料?

實現可靠的表單資料持久化

private async Task SaveFormData()
{
    var pdfWithFormData = PdfDocument.FromFile("filled-form.pdf");

    // Extract form data
    var formData = new Dictionary<string, string>();
    foreach (var field in pdfWithFormData.Form.Fields)
    {
        formData[field.Name] = field.Value;
    }

    // Save to database or JSON
    var json = System.Text.Json.JsonSerializer.Serialize(formData);
    await File.WriteAllTextAsync("form-data.json", json);

    // Flatten form to prevent further editing
    pdfWithFormData.Form.Flatten();
    pdfWithFormData.SaveAs("form-submission.pdf");
}
private async Task SaveFormData()
{
    var pdfWithFormData = PdfDocument.FromFile("filled-form.pdf");

    // Extract form data
    var formData = new Dictionary<string, string>();
    foreach (var field in pdfWithFormData.Form.Fields)
    {
        formData[field.Name] = field.Value;
    }

    // Save to database or JSON
    var json = System.Text.Json.JsonSerializer.Serialize(formData);
    await File.WriteAllTextAsync("form-data.json", json);

    // Flatten form to prevent further editing
    pdfWithFormData.Form.Flatten();
    pdfWithFormData.SaveAs("form-submission.pdf");
}
Private Async Function SaveFormData() As Task
    Dim pdfWithFormData = PdfDocument.FromFile("filled-form.pdf")

    ' Extract form data
    Dim formData As New Dictionary(Of String, String)()
    For Each field In pdfWithFormData.Form.Fields
        formData(field.Name) = field.Value
    Next

    ' Save to database or JSON
    Dim json = System.Text.Json.JsonSerializer.Serialize(formData)
    Await File.WriteAllTextAsync("form-data.json", json)

    ' Flatten form to prevent further editing
    pdfWithFormData.Form.Flatten()
    pdfWithFormData.SaveAs("form-submission.pdf")
End Function
$vbLabelText   $csharpLabel

請考慮專業表單的表單驗證欄位管理

何時應該使用程序化表單填寫,何時應該使用互動式表單填寫?

根據具體用例選擇合適的方法:

方法 使用時機 好處
程式化 預先填入已知數據 更快、更穩定、更自動化
互動的 需要使用者輸入 靈活、即時的驗證
雜交種 部分數據可用 兼具兩種方法的優點

提交後考慮將表格展平,以防止竄改。 為了安全起見,請使用PDF檔案清理功能

輸出

範例展示了 PDF 檢視器元件的表單填寫功能,說明使用者如何直接在瀏覽器中與 PDF 表單進行互動。

如何提高大型PDF檔案的效能?

為了確保在顯示 PDF 文件時(尤其是顯示大型 PDF 文件時)擁有高效能

private async Task LoadLargePdf()
{
    const int chunkSize = 1024 * 1024; // 1MB chunks
    var pdfPath = "largefile.pdf";
    using (var fileStream = File.OpenRead(pdfPath))
    {
        var buffer = new byte[chunkSize];
        var chunks = new List<byte[]>();
        int bytesRead;
        while ((bytesRead = await fileStream.ReadAsync(buffer)) > 0)
        {
            var chunk = new byte[bytesRead];
            Array.Copy(buffer, chunk, bytesRead);
            chunks.Add(chunk);
        }
        // Process chunks for display
        await ProcessPdfChunks(chunks);
    }
}
private async Task LoadLargePdf()
{
    const int chunkSize = 1024 * 1024; // 1MB chunks
    var pdfPath = "largefile.pdf";
    using (var fileStream = File.OpenRead(pdfPath))
    {
        var buffer = new byte[chunkSize];
        var chunks = new List<byte[]>();
        int bytesRead;
        while ((bytesRead = await fileStream.ReadAsync(buffer)) > 0)
        {
            var chunk = new byte[bytesRead];
            Array.Copy(buffer, chunk, bytesRead);
            chunks.Add(chunk);
        }
        // Process chunks for display
        await ProcessPdfChunks(chunks);
    }
}
Private Async Function LoadLargePdf() As Task
    Const chunkSize As Integer = 1024 * 1024 ' 1MB chunks
    Dim pdfPath As String = "largefile.pdf"
    Using fileStream = File.OpenRead(pdfPath)
        Dim buffer(chunkSize - 1) As Byte
        Dim chunks As New List(Of Byte())()
        Dim bytesRead As Integer
        Do
            bytesRead = Await fileStream.ReadAsync(buffer, 0, buffer.Length)
            If bytesRead > 0 Then
                Dim chunk(bytesRead - 1) As Byte
                Array.Copy(buffer, chunk, bytesRead)
                chunks.Add(chunk)
            End If
        Loop While bytesRead > 0
        ' Process chunks for display
        Await ProcessPdfChunks(chunks)
    End Using
End Function
$vbLabelText   $csharpLabel

這種方法分塊載入大型 PDF 文件,防止記憶體問題,即使處理大型 PDF 文件也能確保流暢的效能。 在行動裝置或資源有限的系統上處理 PDF 文件時,它尤其有用。 考慮實施記憶體洩漏預防策略。

其他優化策略包括:

-線性化以實現更快的網頁瀏覽速度 -壓縮以減小檔案大小 -並行處理多個PDF文件

對於Docker 環境,改進容器配置。 在AWS Lambda中,要謹慎管理記憶體分配

檔案大小達到什麼程度需要分塊載入?

考慮根據以下閾值進行分塊加載:

文件大小 裝載策略 記憶體影響
小於 5MB 直接裝載 極簡主義
5-20MB 可選分塊 緩和
20-50MB 推薦分塊 重要的
大於 50MB 需要分塊 批判的

對於大型輸出文件,實施適當的壓縮策略

如何監控記憶體使用情況?

實施記憶體監控以獲得最佳效能

private async Task<bool> CheckMemoryBeforeLoad(long fileSize)
{
    var memoryInfo = GC.GetTotalMemory(false);
    var availableMemory = GC.GetTotalMemory(true);

    // Conservative estimate: file size * 3 for processing overhead
    var requiredMemory = fileSize * 3;

    if (requiredMemory > availableMemory * 0.8) // 80% threshold
    {
        // Trigger garbage collection
        GC.Collect();
        GC.WaitForPendingFinalizers();
        GC.Collect();

        // Re-check after cleanup
        availableMemory = GC.GetTotalMemory(true);
        return requiredMemory <= availableMemory * 0.8;
    }

    return true;
}
private async Task<bool> CheckMemoryBeforeLoad(long fileSize)
{
    var memoryInfo = GC.GetTotalMemory(false);
    var availableMemory = GC.GetTotalMemory(true);

    // Conservative estimate: file size * 3 for processing overhead
    var requiredMemory = fileSize * 3;

    if (requiredMemory > availableMemory * 0.8) // 80% threshold
    {
        // Trigger garbage collection
        GC.Collect();
        GC.WaitForPendingFinalizers();
        GC.Collect();

        // Re-check after cleanup
        availableMemory = GC.GetTotalMemory(true);
        return requiredMemory <= availableMemory * 0.8;
    }

    return true;
}
Private Async Function CheckMemoryBeforeLoad(fileSize As Long) As Task(Of Boolean)
    Dim memoryInfo = GC.GetTotalMemory(False)
    Dim availableMemory = GC.GetTotalMemory(True)

    ' Conservative estimate: file size * 3 for processing overhead
    Dim requiredMemory = fileSize * 3

    If requiredMemory > availableMemory * 0.8 Then ' 80% threshold
        ' Trigger garbage collection
        GC.Collect()
        GC.WaitForPendingFinalizers()
        GC.Collect()

        ' Re-check after cleanup
        availableMemory = GC.GetTotalMemory(True)
        Return requiredMemory <= availableMemory * 0.8
    End If

    Return True
End Function
$vbLabelText   $csharpLabel

監控初始渲染效能,並根據需要進行效能故障排除

何時該考慮使用伺服器端渲染?

在以下情況下,伺服器端渲染會變得有利:

對於IIS 部署,請設定對應的應用程式集區。 Azure Functions需要特定的部署設定

如何為受密碼保護的PDF文件實施安全措施?

處理受密碼保護的PDF檔案時:

private async Task LoadSecurePdf(string password)
{
    var pdfDocument = PdfDocument.FromFile("secure.pdf", password);
    if (pdfDocument != null)
    {
       var headers = new Dictionary<string, string>
        {
            {"X-Frame-Options", "SAMEORIGIN"},
            {"Content-Security-Policy", "default-src 'self'"}
        };
        await DisplayPdfContent(pdfDocument);
    }
}
private async Task LoadSecurePdf(string password)
{
    var pdfDocument = PdfDocument.FromFile("secure.pdf", password);
    if (pdfDocument != null)
    {
       var headers = new Dictionary<string, string>
        {
            {"X-Frame-Options", "SAMEORIGIN"},
            {"Content-Security-Policy", "default-src 'self'"}
        };
        await DisplayPdfContent(pdfDocument);
    }
}
Private Async Function LoadSecurePdf(password As String) As Task
    Dim pdfDocument = PdfDocument.FromFile("secure.pdf", password)
    If pdfDocument IsNot Nothing Then
        Dim headers = New Dictionary(Of String, String) From {
            {"X-Frame-Options", "SAMEORIGIN"},
            {"Content-Security-Policy", "default-src 'self'"}
        }
        Await DisplayPdfContent(pdfDocument)
    End If
End Function
$vbLabelText   $csharpLabel

此程式碼示範如何在保持安全性的同時,透過正確的標頭配置來載入受密碼保護的 PDF 文件。 考慮使用數位簽名來提高身份驗證的有效性。

如何安全處理PDF密碼?

遵循以下最佳實踐,實現安全的密碼管理:

-切勿以明文或客戶端代碼形式儲存密碼 使用安全的輸入方法並進行適當的驗證

  • 對敏感文件實施會話逾時機制
  • 對密碼傳輸應用加密 -記錄存取嘗試以進行安全審計 使用後清除記憶體中的密碼

考慮在企業環境中使用Kerberos 身份驗證確保符合 CVE 安全要求

我應該考慮哪些額外的安全標頭?

使用完整的頁眉提高 PDF 檢視器的安全性:

private void ConfigureSecurityHeaders(HttpResponse response)
{
    response.Headers.Add("X-Content-Type-Options", "nosniff");
    response.Headers.Add("X-Frame-Options", "DENY");
    response.Headers.Add("Content-Security-Policy", 
        "default-src 'self'; script-src 'self' 'unsafe-inline'; object-src 'none'");
    response.Headers.Add("Referrer-Policy", "no-referrer");
    response.Headers.Add("Permissions-Policy", "camera=(), microphone=(), geolocation=()");
}
private void ConfigureSecurityHeaders(HttpResponse response)
{
    response.Headers.Add("X-Content-Type-Options", "nosniff");
    response.Headers.Add("X-Frame-Options", "DENY");
    response.Headers.Add("Content-Security-Policy", 
        "default-src 'self'; script-src 'self' 'unsafe-inline'; object-src 'none'");
    response.Headers.Add("Referrer-Policy", "no-referrer");
    response.Headers.Add("Permissions-Policy", "camera=(), microphone=(), geolocation=()");
}
Private Sub ConfigureSecurityHeaders(response As HttpResponse)
    response.Headers.Add("X-Content-Type-Options", "nosniff")
    response.Headers.Add("X-Frame-Options", "DENY")
    response.Headers.Add("Content-Security-Policy", 
                         "default-src 'self'; script-src 'self' 'unsafe-inline'; object-src 'none'")
    response.Headers.Add("Referrer-Policy", "no-referrer")
    response.Headers.Add("Permissions-Policy", "camera=(), microphone=(), geolocation=()")
End Sub
$vbLabelText   $csharpLabel

實施PDF 清理,以刪除潛在的惡意內容並編輯敏感資訊

客戶端解密和伺服器端解密何時適用?

根據安全需求選擇解密方法:

解密類型 用例 安全等級
客戶端 公開文件 低的
伺服器端 敏感數據 高的
雜交種 混合內容 中等的

為了最大限度地提高安全性,始終在伺服器端執行解密,並將解密後的內容安全地傳輸到客戶端。 為滿足長期存檔需求,實施PDF/A 合規性

Blazor PDF 顯示有哪些關鍵要點?

使用 IronPDF 實作 Blazor PDF 檢視器,可為開發人員提供在 Web 應用程式中顯示 PDF 的完整解決方案。 從基本顯示到表單填寫註釋等進階功能,IronPDF 的PDF 檢視器元件提供了專業應用程式所需的功能。

所示範例示範如何建立一個可靠的 Blazor PDF 檢視器,該檢視器可以處理各種 PDF 來源,提供互動式功能,並保持高效能。 無論您是建立簡單的文件檢視器還是複雜的文件管理系統,IronPDF 與Blazor Server 應用程式的整合都能輕鬆實現專業的 PDF 檢視功能。 Chrome渲染引擎可確保跨平台呈現一致的效果。

使用 IronPDF 進行 Blazor PDF 顯示的主要優勢包括:

-跨平台相容性,渲染效果一致

針對特定部署場景,IronPDF 支援AzureAWSDocker和傳統Windows環境。 該庫還可以與F#VB.NET應用程式整合。

準備好實現您自己的 PDF 檢視器了嗎? 立即開始 IronPDF 的免費試用,以取得完整的文件示範應用程式開發者支持,以便在 Blazor 應用程式中建立有效的 PDF 檢視體驗。 快速入門指南可協助您立即上手,而程式碼範例則示範了實際應用。

常見問題解答

如何使用 IronPDF 在 Blazor 應用程式中顯示 PDF?

IronPDF 提供全面的 API,可讓您在 Blazor 應用程式中渲染並顯示 PDF。透過整合 IronPDF,您可以輕鬆實作功能強大的 PDF 檢視器元件。

使用 IronPDF 檢視 Blazor PDF 有什麼好處?

使用 IronPDF 進行 Blazor PDF 檢視可提供多種優點,例如處理表單欄、建立互動式檢視器,以及在您的應用程式中無縫呈現高品質的 PDF。

是否可以在 Blazor 中使用 IronPDF 處理 PDF 中的表單欄位?

是的,IronPDF 允許您在 Blazor 應用程式中處理和操作 PDF 文件中的表單欄位,提供增強的互動性和使用者參與度。

IronPDF 是否可用於在 Blazor 中建立互動式 PDF 檢視器?

絕對可以。IronPDF 提供在 Blazor 中建立互動式 PDF 檢視器的工具,可實現表單處理和動態內容顯示等功能。

IronPDF 為 Blazor 中的 PDF 處理提供哪些功能?

IronPDF 提供 PDF 渲染、表單欄位處理、文字萃取和頁面處理等功能,使其成為 Blazor 中 PDF 操作的多功能選擇。

IronPDF 如何增強 Blazor 應用程式中的 PDF 檢視體驗?

IronPDF 可提供流暢的渲染、互動功能以及強大的 PDF 文件處理能力,從而增強 Blazor 應用程式中的 PDF 檢視體驗。

Curtis Chau
技術撰稿人

Curtis Chau 擁有電腦科學學士學位(卡爾頓大學),專長於前端開發,精通 Node.js、TypeScript、JavaScript 和 React。Curtis 對製作直覺且美觀的使用者介面充滿熱情,他喜歡使用現代化的架構,並製作結構良好且視覺上吸引人的手冊。

除了開發之外,Curtis 對物聯網 (IoT) 也有濃厚的興趣,他喜歡探索整合硬體與軟體的創新方式。在空閒時間,他喜歡玩遊戲和建立 Discord bots,將他對技術的熱愛與創意結合。