A PHP Error was encountered

Severity: Notice

Message: Undefined index: path

Filename: libraries/PostRender.php

Line Number: 110

Backtrace:

File: /var/www/ironpdf.com/application/libraries/PostRender.php
Line: 110
Function: _error_handler

File: /var/www/ironpdf.com/application/libraries/PostRender.php
Line: 66
Function: render_view_with_translated_links

File: /var/www/ironpdf.com/index.php
Line: 292
Function: require_once

Foxit PDF 查看器 For .NET SDK 替代品 | IronPDF 跳過到頁腳內容
產品比較

IronPDF與Foxit PDF SDK的比較

PDF 文件已成為廣泛用於共享和展示資訊的格式。 開發人員經常需要從其應用程式生成 PDF 文件或操作現有文件以滿足其要求。 這就是 PDF 處理 SDK 派上用場的地方。 這些 SDK 提供開發人員必要的工具和功能,以便在其應用程式中創建、編輯和處理 PDF 文件。

Foxit PDF SDK 和 IronPDF 是市場上可用的兩個最受歡迎的 PDF 處理 SDK。 兩個 SDK 都提供滿足開發人員需求的廣泛功能,但它們在某些方面有所不同,這使得它們適合於不同的場景。

在本文中,我們將深入探討 Foxit PDF SDK 和 IronPDF 的功能和優勢,並進行並排比較。 我們將檢查每個 SDK 的優勢和劣勢,並分析它們的能力。 這將幫助您選擇最適合您具體需要的 PDF 處理 SDK。

IronPDF 概述

IronPDF is a powerful PDF processing SDK developed by Iron Software 開發的強大PDF處理SDK,允許開發人員在 .NET 應用程式中創建、編輯和操縱 PDF 文件。 它提供了一套全面的工具和功能,以滿足經常處理 PDF 文件的開發人員的需求。

IronPDF 功能

HTML轉換為PDF

IronPDF 允許開發人員輕鬆地將 HTML 代碼轉換為 PDF 文件。 轉換過程簡單快捷,開發人員可以通過設置各種選項來控制輸出,如頁面大小、邊距和方向。 IronPDF 還支持高級格式選項,如頁眉和頁腳,允許開發人員細緻調整 PDF 輸出的佈局。 開發人員還可以指定 HTML 代碼中的哪些元素應包含在 PDF 輸出中,從而更好地控制生成的 PDF 文件的內容。

生成 PDF 文件

IronPDF 的一個關鍵功能是能夠從多種來源生成 PDF,包括 HTML、URL、JavaScript、CSS 和多種圖像格式。 這意味著開發人員可以直接從網頁或圖像創建 PDF 文件,而無需手動轉換或操作。 通過使用 IronPDF 的先進渲染引擎,開發人員可以準確可靠地將復雜的網頁轉換為高質量的 PDF 文件。 這一功能對於需要動態生成 PDF 報告、發票或其他文件的應用程式非常有用,因為它簡化了過程,並減少了所需的手動干預。

PDF 提取

IronPDF 的 PDF 提取功能使開發人員能夠從 PDF 文件中提取各種類型的內容,包括文本、圖像和其他數據。 這對於在其他應用程式中重新利用內容或分析 PDF 數據非常有用。 IronPDF 還提供先進的文本提取能力,允許開發人員提取保留格式的文本,而其他 PDF 提取工具可能難以實現。 此外,IronPDF 支持圖像提取,使開發人員能夠從 PDF 文件中提取多種格式的圖像,如 PNG 或 JPEG。 憑藉這些強大的 PDF 提取功能,IronPDF 為開發人員提供了一個靈活高效的工具以處理 PDF 數據。

註解與表單填寫

IronPDF 支持註解和表單填寫,這是需要用戶與 PDF 文件交互的應用程式的必要功能。 開發人員可以向 PDF 文件中添加文本、圖像和其他元素,還可以包括用戶可以填寫的表單字段。 IronPDF 還提供用於處理 PDF 表單數據的 API,允許開發人員在其應用程式中提取和處理表單數據。

PDF 輸出控制

IronPDF 提供一系列選項來控制 PDF 文件的輸出。 開發人員可以設置各種屬性,如頁面大小、邊距和方向。 他們還可以指定壓縮級別、安全設置以及其他高級選項以控制 PDF 的輸出。 此外,IronPDF 還提供了一些選項來處理 PDF 頁面,包括合併、拆分和重新排序 PDF 文件中的頁面。

多線程與異步支持

IronPDF 提供完整的多線程和異步支持,優化了 PDF 處理任務的性能。 通過多線程支持,開發人員可以在多個線程上同時執行 PDF 處理任務,從而提高性能並縮短執行時間。 異步支持允許開發人員在後台執行長時間任務,如 PDF 轉換或圖像提取,而不會阻塞主應用程式線程。 這確保了應用程式保持響應並提供更好的用戶體驗。 通過利用這些功能,開發人員可以創建高性能、效率和可靠性兼備的應用程式。

全面的安全保障

IronPDF 的安全功能為開發人員提供了一套全面的工具來保護 PDF 文件,確保敏感數據的安全性和完整性。 可以在文件或頁面級別設置密碼保護,限制對特定功能的訪問,如打印、拷貝或編輯。 加密選項包括 40 位和 128 位加密,為防止未經授權的訪問提供了一層強大的保護。 數字簽名和證書管理功能允許開發人員驗證文件簽名者並確保文件未被修改。 這些功能使得 IronPDF 對於需要安全功能以保護敏感數據的應用程式而言是一個不錯的選擇。

.NET 語言支持

IronPDF 專為 .NET 開發人員設計,並與 C# 和 VB.NET 等 .NET 語言無縫集成。 該 SDK 提供一系列 API,使開發人員可以輕鬆在 .NET 應用程式中創建、編輯和操作 PDF 文件。 開發人員還可以利用 IronPDF 提供的豐富文檔和代碼示例,讓他們輕鬆上手這個 SDK。 IronPDF 也有 Java 版本。

Foxit PDF SDK 概述

Foxit PDF SDK 是一個強大的軟體開發工具包,允許開發人員將 PDF 處理功能集成到他們的應用程式中。 它提供的功能包括創建、閱讀、編輯和註解 PDF 文件,以及允許開發人員轉換 PDF 文件。

PDF 創建與轉換

Foxit PDF SDK 允許開發人員從頭開始創建新的 PDF 文件或將現有文件轉換為 PDF 格式。 它支持多種文件格式,包括 Microsoft Word、Excel、PowerPoint 及其他格式。 SDK 還支持將圖像格式如 JPEG、PNG 和 TIFF 轉換為 PDF。

PDF 編輯

Foxit PDF SDK 為開發人員提供了一套強大的編輯工具來修改 PDF 文件。 這些工具包括文本編輯工具、圖像裁剪、頁面重排和添加水印或背景。 該 SDK 還允許添加或刪除頁面、合併或拆分 PDF 文件,以及修改文檔元數據。

PDF 註解

Foxit PDF SDK 允許開發人員向 PDF 文件中添加註解。 這些註解包括高亮顯示、評論、印章和其他視覺輔助工具。 它還提供創建自定義註解工具的功能,如簽名或印章。

PDF 安全性

Foxit PDF SDK 為開發人員提供先進的安全功能,以防止未經授權的訪問。 包括密碼保護、數字簽名、加密和證書管理。

PDF 優化

Foxit PDF SDK 包括工具來優化 PDF 文件的加載速度和性能。 這包括壓縮、圖像下採樣、字體嵌入等功能。 這些優化功能可以幫助減少文件大小,提高加載速度,提高 PDF 文件的可訪問性和用戶友好性。

PDF 表單填寫

Foxit PDF SDK 允許開發人員創建和填寫 PDF 表單。 這包括創建可編程填寫的動態表單的能力。 該 SDK 還支持表單字段驗證和數據提取,更便於收集和分析表單數據。

PDF 提取

Foxit PDF SDK 為開發人員提供工具,以便從 PDF 文件中提取文本、圖像和其他內容。 這對於在其他應用程式中重新利用內容或分析 PDF 數據非常有用。

現在,讓我們討論這兩個庫的一個基本代碼示例。

Bootstrap 和現代 CSS 框架支持

對於生成 PDF 報告和文件的現代 Web 應用程式,Bootstrap 和 CSS 框架支持至關重要。 能夠將 Bootstrap 風格的界面直接轉換为 PDF 而無需修改,節省了大量的開發時間,並確保網頁和 PDF 輸出之間的設計一致性。

IronPDF: 完整的 Bootstrap 與 CSS 框架支持

  • Bootstrap 5: 完全支持 flexbox 布局、CSS 網格、實用程序類和所有組件系統
  • Bootstrap 4: 完整的卡片組件、導航元素、彈性實用程序和響應設計
  • Tailwind CSS:所有實用工具類均準確渲染
  • Foundation: 完整的網格系統和組件庫
  • 現代 CSS3: Flexbox、CSS 網格、自定義屬性、動畫、過渡和變換

Real-world validation: IronPDF successfully renders the Bootstrap homepage and all official examples with pixel-perfect accuracy.

代碼示例: 通知系統與警報

using IronPdf;

// Set your IronPDF license key
IronPdf.License.LicenseKey = "License-Key goes here";

var renderer = new ChromePdfRenderer();
string bootstrapNotifications = @"
<!DOCTYPE html>
<html>
<head>
    <link href='https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css' rel='stylesheet'>
    <style>
        .notification-card {
            border-left: 4px solid;
            transition: transform 0.2s;
        }
        .notification-card:hover { transform: translateX(5px); }
        .notification-icon {
            width: 48px;
            height: 48px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            font-size: 1.5rem;
        }
    </style>
</head>
<body>
    <div class='container my-5'>
        <h1 class='mb-4'>System Notifications Dashboard</h1>

        <div class='row g-4 mb-4'>
            <div class='col-md-3'>
                <div class='card text-center bg-success text-white'>
                    <div class='card-body'>
                        <h2 class='display-4 mb-0'>42</h2>
                        <p class='mb-0'>Success</p>
                    </div>
                </div>
            </div>
            <div class='col-md-3'>
                <div class='card text-center bg-warning text-dark'>
                    <div class='card-body'>
                        <h2 class='display-4 mb-0'>8</h2>
                        <p class='mb-0'>Warnings</p>
                    </div>
                </div>
            </div>
            <div class='col-md-3'>
                <div class='card text-center bg-danger text-white'>
                    <div class='card-body'>
                        <h2 class='display-4 mb-0'>3</h2>
                        <p class='mb-0'>Errors</p>
                    </div>
                </div>
            </div>
            <div class='col-md-3'>
                <div class='card text-center bg-info text-white'>
                    <div class='card-body'>
                        <h2 class='display-4 mb-0'>156</h2>
                        <p class='mb-0'>Info</p>
                    </div>
                </div>
            </div>
        </div>

        <div class='alert alert-success d-flex align-items-center mb-3' role='alert'>
            <div class='notification-icon bg-white text-success me-3'>✓</div>
            <div class='flex-grow-1'>
                <h5 class='alert-heading mb-1'>Deployment Successful</h5>
                <p class='mb-0'>Your application has been deployed to production successfully.</p>
                <small class='text-muted'>2 minutes ago</small>
            </div>
            <button type='button' class='btn-close'></button>
        </div>

        <div class='alert alert-info d-flex align-items-center mb-3' role='alert'>
            <div class='notification-icon bg-white text-info me-3'>ℹ</div>
            <div class='flex-grow-1'>
                <h5 class='alert-heading mb-1'>System Update Available</h5>
                <p class='mb-0'>A new system update (v2.5.1) is available for installation.</p>
                <small class='text-muted'>15 minutes ago</small>
            </div>
            <button type='button' class='btn-close'></button>
        </div>

        <div class='alert alert-warning d-flex align-items-center mb-3' role='alert'>
            <div class='notification-icon bg-white text-warning me-3'>⚠</div>
            <div class='flex-grow-1'>
                <h5 class='alert-heading mb-1'>High CPU Usage Detected</h5>
                <p class='mb-0'>CPU usage has exceeded 85% for the past 10 minutes. Consider scaling resources.</p>
                <small class='text-muted'>1 hour ago</small>
            </div>
            <button type='button' class='btn-close'></button>
        </div>

        <div class='alert alert-danger d-flex align-items-center mb-3' role='alert'>
            <div class='notification-icon bg-white text-danger me-3'>✗</div>
            <div class='flex-grow-1'>
                <h5 class='alert-heading mb-1'>Database Connection Failed</h5>
                <p class='mb-0'>Unable to establish connection to the primary database server. Failover initiated.</p>
                <small class='text-muted'>3 hours ago</small>
            </div>
            <button type='button' class='btn-close'></button>
        </div>

        <div class='card'>
            <div class='card-header bg-primary text-white'>
                <h5 class='mb-0'>Recent Activity Log</h5>
            </div>
            <div class='card-body p-0'>
                <ul class='list-group list-group-flush'>
                    <li class='list-group-item notification-card border-success'>
                        <div class='d-flex align-items-start'>
                            <span class='badge bg-success me-3 mt-1'>SUCCESS</span>
                            <div class='flex-grow-1'>
                                <strong>Backup Completed</strong>
                                <p class='mb-1 text-muted'>Daily backup completed successfully. 2.4 GB backed up.</p>
                                <small class='text-muted'>Today at 3:00 AM</small>
                            </div>
                        </div>
                    </li>
                    <li class='list-group-item notification-card border-info'>
                        <div class='d-flex align-items-start'>
                            <span class='badge bg-info me-3 mt-1'>INFO</span>
                            <div class='flex-grow-1'>
                                <strong>User Login</strong>
                                <p class='mb-1 text-muted'>Admin user logged in from 192.168.1.100</p>
                                <small class='text-muted'>Today at 8:30 AM</small>
                            </div>
                        </div>
                    </li>
                    <li class='list-group-item notification-card border-warning'>
                        <div class='d-flex align-items-start'>
                            <span class='badge bg-warning text-dark me-3 mt-1'>WARNING</span>
                            <div class='flex-grow-1'>
                                <strong>SSL Certificate Expiring</strong>
                                <p class='mb-1 text-muted'>SSL certificate for api.example.com expires in 30 days</p>
                                <small class='text-muted'>Today at 9:15 AM</small>
                            </div>
                        </div>
                    </li>
                    <li class='list-group-item notification-card border-success'>
                        <div class='d-flex align-items-start'>
                            <span class='badge bg-success me-3 mt-1'>SUCCESS</span>
                            <div class='flex-grow-1'>
                                <strong>Security Scan Completed</strong>
                                <p class='mb-1 text-muted'>No vulnerabilities detected in latest scan</p>
                                <small class='text-muted'>Today at 10:00 AM</small>
                            </div>
                        </div>
                    </li>
                </ul>
            </div>
        </div>

        <div class='mt-4 d-flex justify-content-between align-items-center'>
            <button class='btn btn-outline-primary'>Mark All as Read</button>
            <button class='btn btn-outline-secondary'>Clear All</button>
            <button class='btn btn-primary'>View All Notifications</button>
        </div>
    </div>
</body>
</html>";

var pdf = renderer.RenderHtmlAsPdf(bootstrapNotifications);
pdf.SaveAs("notifications-dashboard.pdf");
using IronPdf;

// Set your IronPDF license key
IronPdf.License.LicenseKey = "License-Key goes here";

var renderer = new ChromePdfRenderer();
string bootstrapNotifications = @"
<!DOCTYPE html>
<html>
<head>
    <link href='https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css' rel='stylesheet'>
    <style>
        .notification-card {
            border-left: 4px solid;
            transition: transform 0.2s;
        }
        .notification-card:hover { transform: translateX(5px); }
        .notification-icon {
            width: 48px;
            height: 48px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            font-size: 1.5rem;
        }
    </style>
</head>
<body>
    <div class='container my-5'>
        <h1 class='mb-4'>System Notifications Dashboard</h1>

        <div class='row g-4 mb-4'>
            <div class='col-md-3'>
                <div class='card text-center bg-success text-white'>
                    <div class='card-body'>
                        <h2 class='display-4 mb-0'>42</h2>
                        <p class='mb-0'>Success</p>
                    </div>
                </div>
            </div>
            <div class='col-md-3'>
                <div class='card text-center bg-warning text-dark'>
                    <div class='card-body'>
                        <h2 class='display-4 mb-0'>8</h2>
                        <p class='mb-0'>Warnings</p>
                    </div>
                </div>
            </div>
            <div class='col-md-3'>
                <div class='card text-center bg-danger text-white'>
                    <div class='card-body'>
                        <h2 class='display-4 mb-0'>3</h2>
                        <p class='mb-0'>Errors</p>
                    </div>
                </div>
            </div>
            <div class='col-md-3'>
                <div class='card text-center bg-info text-white'>
                    <div class='card-body'>
                        <h2 class='display-4 mb-0'>156</h2>
                        <p class='mb-0'>Info</p>
                    </div>
                </div>
            </div>
        </div>

        <div class='alert alert-success d-flex align-items-center mb-3' role='alert'>
            <div class='notification-icon bg-white text-success me-3'>✓</div>
            <div class='flex-grow-1'>
                <h5 class='alert-heading mb-1'>Deployment Successful</h5>
                <p class='mb-0'>Your application has been deployed to production successfully.</p>
                <small class='text-muted'>2 minutes ago</small>
            </div>
            <button type='button' class='btn-close'></button>
        </div>

        <div class='alert alert-info d-flex align-items-center mb-3' role='alert'>
            <div class='notification-icon bg-white text-info me-3'>ℹ</div>
            <div class='flex-grow-1'>
                <h5 class='alert-heading mb-1'>System Update Available</h5>
                <p class='mb-0'>A new system update (v2.5.1) is available for installation.</p>
                <small class='text-muted'>15 minutes ago</small>
            </div>
            <button type='button' class='btn-close'></button>
        </div>

        <div class='alert alert-warning d-flex align-items-center mb-3' role='alert'>
            <div class='notification-icon bg-white text-warning me-3'>⚠</div>
            <div class='flex-grow-1'>
                <h5 class='alert-heading mb-1'>High CPU Usage Detected</h5>
                <p class='mb-0'>CPU usage has exceeded 85% for the past 10 minutes. Consider scaling resources.</p>
                <small class='text-muted'>1 hour ago</small>
            </div>
            <button type='button' class='btn-close'></button>
        </div>

        <div class='alert alert-danger d-flex align-items-center mb-3' role='alert'>
            <div class='notification-icon bg-white text-danger me-3'>✗</div>
            <div class='flex-grow-1'>
                <h5 class='alert-heading mb-1'>Database Connection Failed</h5>
                <p class='mb-0'>Unable to establish connection to the primary database server. Failover initiated.</p>
                <small class='text-muted'>3 hours ago</small>
            </div>
            <button type='button' class='btn-close'></button>
        </div>

        <div class='card'>
            <div class='card-header bg-primary text-white'>
                <h5 class='mb-0'>Recent Activity Log</h5>
            </div>
            <div class='card-body p-0'>
                <ul class='list-group list-group-flush'>
                    <li class='list-group-item notification-card border-success'>
                        <div class='d-flex align-items-start'>
                            <span class='badge bg-success me-3 mt-1'>SUCCESS</span>
                            <div class='flex-grow-1'>
                                <strong>Backup Completed</strong>
                                <p class='mb-1 text-muted'>Daily backup completed successfully. 2.4 GB backed up.</p>
                                <small class='text-muted'>Today at 3:00 AM</small>
                            </div>
                        </div>
                    </li>
                    <li class='list-group-item notification-card border-info'>
                        <div class='d-flex align-items-start'>
                            <span class='badge bg-info me-3 mt-1'>INFO</span>
                            <div class='flex-grow-1'>
                                <strong>User Login</strong>
                                <p class='mb-1 text-muted'>Admin user logged in from 192.168.1.100</p>
                                <small class='text-muted'>Today at 8:30 AM</small>
                            </div>
                        </div>
                    </li>
                    <li class='list-group-item notification-card border-warning'>
                        <div class='d-flex align-items-start'>
                            <span class='badge bg-warning text-dark me-3 mt-1'>WARNING</span>
                            <div class='flex-grow-1'>
                                <strong>SSL Certificate Expiring</strong>
                                <p class='mb-1 text-muted'>SSL certificate for api.example.com expires in 30 days</p>
                                <small class='text-muted'>Today at 9:15 AM</small>
                            </div>
                        </div>
                    </li>
                    <li class='list-group-item notification-card border-success'>
                        <div class='d-flex align-items-start'>
                            <span class='badge bg-success me-3 mt-1'>SUCCESS</span>
                            <div class='flex-grow-1'>
                                <strong>Security Scan Completed</strong>
                                <p class='mb-1 text-muted'>No vulnerabilities detected in latest scan</p>
                                <small class='text-muted'>Today at 10:00 AM</small>
                            </div>
                        </div>
                    </li>
                </ul>
            </div>
        </div>

        <div class='mt-4 d-flex justify-content-between align-items-center'>
            <button class='btn btn-outline-primary'>Mark All as Read</button>
            <button class='btn btn-outline-secondary'>Clear All</button>
            <button class='btn btn-primary'>View All Notifications</button>
        </div>
    </div>
</body>
</html>";

var pdf = renderer.RenderHtmlAsPdf(bootstrapNotifications);
pdf.SaveAs("notifications-dashboard.pdf");
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

輸出: 使用 Bootstrap 5 的告警組件、flexbox佈局、徽章工具、卡片系統和列表組的專業通知儀錶板 PDF,所有這些都以完美的顏色準確性、間距和視覺層次渲染。

Foxit PDF SDK: 有限的現代 CSS 支持

Foxit PDF SDK 使用自定義渲染引擎,對於現代 CSS 框架有記錄的限制:

  • 部分 CSS3 支持: 現代 flexbox 和 CSS 網格功能可能無法正確渲染
  • Bootstrap 4/5 的限制: 複雜的佈局需要廣泛的測試和權宜之計
  • JavaScript 限制: 與瀏覽器環境相比,執行受到限製
  • 框架兼容性: 並非為 Bootstrap 或現代框架設計

文件指出,高級 CSS 功能可能會產生意想不到的結果,開發人員報告了響應實用程序、基於 flex 的佈局和現代 Bootstrap 組件的問題。

開發影響: 使用 Foxit PDF SDK 的團隊通常需要創建簡化的佈局或維護單獨的“PDF 安全”CSS 文件,增加了開發負擔,並降低了 Web 應用程式和 PDF 文件之間的設計一致性。

有關詳細的 Bootstrap 框架兼容性和 CSS3 渲染功能,請參閱 Bootstrap &amp; Flexbox CSS 指南

代碼示例

讓我們創建一個新的 Visual Studio 項目,使用控制台應用程式模板來演示代碼示例。

創建新項目:

  • 打開 Visual Studio 2022(您可以打開任何版本)。
  • 從開始頁面單擊“創建新項目”,或從頂部菜單選擇“文件”>“新建”>“項目”。
  • 在“創建新項目”對話框中,在“控制台”標籤下選擇“控制台應用程序 (.NET Core)”。
  • 為您的項目選擇一個名稱和位置,然後單擊“創建”。
  • Visual Studio 將創建一個具有默認 Program.cs 文件的新控制台應用程式項目。

IronPDF 和 Foxit PDF SDK 之間的比較:圖 1 - 在 VS 2022 中創建新項目

代碼示例 of IronPDF

我們需要在我們的項目中安裝 IronPDF NuGet 包

單擊“工具”菜單,選擇“NuGet 包管理器”,然後選擇“包管理器控制台”。

在包管理器控制台窗口中,輸入以下命令:

Install-Package IronPdf

按“Enter”鍵執行命令。 等待包安裝完成,並解析其相依項。

IronPDF 和 Foxit PDF SDK 之間的比較:圖2 - 安裝 IronPDF

一旦安裝完成,我們就可以通過添加合適的 using 語句並調用 IronPDF 的 API 在項目中開始使用 IronPDF。

// This C# code will demonstrate how to use IronPDF to create a new PDF from HTML content.
static void Main(string[] args)
{
    // Create an instance of ChromePdfRenderer to render HTML as a PDF document.
    var renderer = new ChromePdfRenderer();

    // Convert HTML content to a PDF document using RenderHtmlAsPdf.
    var pdfDoc = renderer.RenderHtmlAsPdf("This is my PDF file created by IronPDF.");

    // Save the PDF document to the filename "IronPDF.pdf".
    pdfDoc.SaveAs("IronPDF.pdf");
}
// This C# code will demonstrate how to use IronPDF to create a new PDF from HTML content.
static void Main(string[] args)
{
    // Create an instance of ChromePdfRenderer to render HTML as a PDF document.
    var renderer = new ChromePdfRenderer();

    // Convert HTML content to a PDF document using RenderHtmlAsPdf.
    var pdfDoc = renderer.RenderHtmlAsPdf("This is my PDF file created by IronPDF.");

    // Save the PDF document to the filename "IronPDF.pdf".
    pdfDoc.SaveAs("IronPDF.pdf");
}
' This C# code will demonstrate how to use IronPDF to create a new PDF from HTML content.
Shared Sub Main(ByVal args() As String)
	' Create an instance of ChromePdfRenderer to render HTML as a PDF document.
	Dim renderer = New ChromePdfRenderer()

	' Convert HTML content to a PDF document using RenderHtmlAsPdf.
	Dim pdfDoc = renderer.RenderHtmlAsPdf("This is my PDF file created by IronPDF.")

	' Save the PDF document to the filename "IronPDF.pdf".
	pdfDoc.SaveAs("IronPDF.pdf")
End Sub
$vbLabelText   $csharpLabel

上面的代碼示例從 HTML 字符串生成了一個 PDF 文件。 它創建了 ChromePdfRenderer 類的新實例,這個類負責將 HTML 渲染為 PDF。 然後,它調用了 RenderHtmlAsPdf 方法,從 HTML 字符串創建一個 PDF 文件。 最後,它使用 SaveAs 方法將 PDF 文件保存到磁碟名稱為“ IronPDF.pdf”。

可以看到,我們只用了三行代碼就生成並保存了 PDF 文件。 這是 IronPDF 所獨有的簡單性和易用性。

IronPDF 和 Foxit PDF SDK 的比較:圖 3 - 使用 IronPDF 創建的 PDF

欲瞭解更多詳細的代碼示例和分步教學,請訪問 IronPDF 的官方 API 文檔

代碼示例 of Foxit PDF SDK

在包管理器控制台窗口中,輸入以下命令:

Install-Package Foxit.SDK.Dotnet

按“Enter”鍵執行命令。 等待包安裝完成,並解析其相依項。

IronPDF 和 Foxit PDF SDK 之間的比較:圖 4 - 安裝 Foxit PDF SDK

安裝完成後,我們就可以通過適當的 "using" 語句和調用 Foxit PDF 的 API 開始在項目中使用 Foxit PDF。

// This C# code demonstrates creating a simple PDF document using Foxit PDF SDK.
using (var doc = new PDFDoc())
{
    // Insert a new page in the PDF document.
    var page = doc.InsertPage(0, PDFPage.Size.e_SizeLetter);

    // Define a rectangular area where text will be added on the page.
    RectF rect = new RectF(100, 50, 220, 100);

    // Create a style for the text to be added.
    RichTextStyle richtext_style = new RichTextStyle();

    // Add text to the page within the defined rectangle.
    page.AddText("This is my PDF generated by Foxit PDF.", rect, richtext_style);

    // Save the document as a PDF file on the disk.
    doc.SaveAs("FoxitPDF.pdf", 0);
}
// This C# code demonstrates creating a simple PDF document using Foxit PDF SDK.
using (var doc = new PDFDoc())
{
    // Insert a new page in the PDF document.
    var page = doc.InsertPage(0, PDFPage.Size.e_SizeLetter);

    // Define a rectangular area where text will be added on the page.
    RectF rect = new RectF(100, 50, 220, 100);

    // Create a style for the text to be added.
    RichTextStyle richtext_style = new RichTextStyle();

    // Add text to the page within the defined rectangle.
    page.AddText("This is my PDF generated by Foxit PDF.", rect, richtext_style);

    // Save the document as a PDF file on the disk.
    doc.SaveAs("FoxitPDF.pdf", 0);
}
' This C# code demonstrates creating a simple PDF document using Foxit PDF SDK.
Using doc = New PDFDoc()
	' Insert a new page in the PDF document.
	Dim page = doc.InsertPage(0, PDFPage.Size.e_SizeLetter)

	' Define a rectangular area where text will be added on the page.
	Dim rect As New RectF(100, 50, 220, 100)

	' Create a style for the text to be added.
	Dim richtext_style As New RichTextStyle()

	' Add text to the page within the defined rectangle.
	page.AddText("This is my PDF generated by Foxit PDF.", rect, richtext_style)

	' Save the document as a PDF file on the disk.
	doc.SaveAs("FoxitPDF.pdf", 0)
End Using
$vbLabelText   $csharpLabel

這是一個具有複雜 API 的庫,對於基礎任務需要更多的努力,從上面的代碼片段中可以看出,這個片段創建了一個簡單的 PDF 文件。訪問他們的 官方文獻以獲取更多的 API 文檔。

使用 IronPDF 將 HTML 轉換為 PDF

以下示例代碼演示了從 HTML 創建 PDF 的示例。

// This C# code will demonstrate how to convert HTML to a PDF using IronPDF.
static void Main(string[] args)
{
    // HTML content to be converted to PDF.
    string htmlText = "This is a PDF created from an HTML string using IronPDF.";

    // Create an instance of ChromePdfRenderer for rendering HTML to PDF.
    var renderer = new ChromePdfRenderer();

    // Render the HTML content as a PDF document.
    PdfDocument pdf = renderer.RenderHtmlAsPdf(htmlText);

    // Save the PDF document to the filename "htmlToPDF.pdf".
    pdf.SaveAs("htmlToPDF.pdf");
}
// This C# code will demonstrate how to convert HTML to a PDF using IronPDF.
static void Main(string[] args)
{
    // HTML content to be converted to PDF.
    string htmlText = "This is a PDF created from an HTML string using IronPDF.";

    // Create an instance of ChromePdfRenderer for rendering HTML to PDF.
    var renderer = new ChromePdfRenderer();

    // Render the HTML content as a PDF document.
    PdfDocument pdf = renderer.RenderHtmlAsPdf(htmlText);

    // Save the PDF document to the filename "htmlToPDF.pdf".
    pdf.SaveAs("htmlToPDF.pdf");
}
' This C# code will demonstrate how to convert HTML to a PDF using IronPDF.
Shared Sub Main(ByVal args() As String)
	' HTML content to be converted to PDF.
	Dim htmlText As String = "This is a PDF created from an HTML string using IronPDF."

	' Create an instance of ChromePdfRenderer for rendering HTML to PDF.
	Dim renderer = New ChromePdfRenderer()

	' Render the HTML content as a PDF document.
	Dim pdf As PdfDocument = renderer.RenderHtmlAsPdf(htmlText)

	' Save the PDF document to the filename "htmlToPDF.pdf".
	pdf.SaveAs("htmlToPDF.pdf")
End Sub
$vbLabelText   $csharpLabel

Additionally, we can also create PDFs from a URL, and from an HTML file using IronPDF.

IronPDF 和 Foxit PDF SDK 之間的比較:圖5 - IronPDF

使用 Foxit PDF SDK 將 HTML 轉換為 PDF

Foxit PDF 庫不支持 將整個 HTML 文件轉換為 PDF

現在,我們已提供了兩個 SDK 的概述,我們來更詳細地比較它們。

IronPDF 和 Foxit PDF 的比較

HTML 到 PDF 轉換

IronPDF 提供了出色的 HTML 內容到 PDF 格式的轉換支持。 這是相對於不提供內置 HTML 到 PDF 轉換支持的 Foxit SDK 的一個顯著優勢。 這一功能對於希望從網頁或應用程式生成動態 PDF 的開發人員尤其有用。

IronPDF 的 HTML 到 PDF 轉換功能高度可定製化。 開發人員可以指定如頁面大小、方向、邊距和縮放等選項,並可在文檔保存前改變 PDF 文件的內容。 此外,IronPDF 支持 CSS 樣式化,這使得創建視覺上吸引人的 PDF 文件變得輕而易舉。

支持 .NET 語言

IronPDF 是一個 .NET 庫,這意味著它可以與任何 .NET 語言共用,如 C#、VB.NET 和 F#。 這讓已經熟悉這些語言的開發人員可以更輕鬆地上手 IronPDF 。 相比之下,Foxit PDF SDK 擁有多種編程語言的語言綁定,但可能不支持開發人員熟悉的所有語言。

IronPDF 還支持 .NET 標準和 .NET Core,使其能夠在 Windows、Linux 和 macOS 等多個平台上使用 IronPDF 。 這種平台支持的靈活性相對於 Foxit PDF SDK 存在一個顯著的優勢,因為可能需要只使用一個支持特定操作系統的 SDK。 這意味着每個操作系統需要一個單獨的 SDK。

易用性

IronPDF 以其易用性而聞名,因為它提供了一個簡單的核心 API ,該 API 抽象了解創建和操縱 PDF 的複雜性。 其直觀的語法允許開發人員僅僅用幾行代碼來創建和编辑 PDF ,不需要其他的技術知識。 另一方面,Foxit PDF SDK 使用起來相對困難,因為它要求開發人員幾乎明確地定義所有東西。 這意味著開發人員需要對 SDK 和 PDF 規範有一個徹底的理解,以便有效地使用它。 這可能會導致開發時間更長,入門的學習曲線更陡峭。 總體而言,IronPDF 的易用性提供了一個無縫的開發體驗,可以帶來更快的開發時間和更高的生產率。

安全功能

IronPDF 和 Foxit PDF SDK 均提供安全功能,以避免未經授權的 PDF 文件存取,例如密碼保護、加密和數字簽名。 不過,IronPDF 在加密選擇方面提供了更大的靈活性,允許開發人員從各種加密算法和鍵長中進行選擇,以根據其具體需求量身定製安全措施。 結合高水平的靈活性,對於需要更高水平的應用程式而言,這是至關重要的安全,如那些處理敏感數據或機密資訊的應用程式。 相比之下,Foxit PDF SDK 在加密選擇方面可能有更有限,可能不足以滿足具有更嚴格的安全需求的應用程式。

性能

IronPDF 被設計用來快速和有效地處理 PDF 文件。 IronPDF 使用的優化算法,保證了當處理 PDF 文件時,性能相對較快。 此外的,IronPDF 可以輕鬆處理大 PDF 文件,使其成為需求處理大量數據的應用程式的一個不錯選擇。 另一方面,Foxit PDF SDK 在處理大 PDF 文件時,可能不像 IronPDF 那麼高效,這可能導致在處理 PDF 文件時性能下降。

授權與定價

IronPDF 提供靈活的授權與定價選擇,以滿足個別開發人員和組織的需求。 開發是免費的,並為商業執照提供 免費試用。 它有 永久許可模式,這意味著一旦您購買了許可證,您可以無限期地使用它,而沒有任何額外的費用或收費。 此外,IronPDF 提供多種授權選擇,包括單一開發人員授權、團隊授權和網站授權,使開發人員容易選擇最適合其需求的選項。

IronPDF 和 Foxit PDF SDK 之間的比較:圖 6 - IronPDF 授權

相對,Foxit PDF SDK 提供基於訂閲的授權模式,這意味著您需要支付經常性費用來使用 SDK。 Foxit PDF SDK 授權起價 3,000 美元,每平台,每年。 這對於從事長期項目或需要大量許可證的開發人員而言,可能會很昂貴。 Foxit PDF SDK 的授權選擇有限,對於所有組織可能不適合。

IronPDF 和 Foxit PDF SDK 之間的比較:圖 7 - Foxit PDF SDK 授權

結論

IronPDF 是一個強大的 PDF 處理庫,在其可易用性和強大功能性方面表現優異。 它建立在一個基於 Chromium 的渲染引擎之上,為開發人員提供了一個簡單和直觀的 API 用於創建、操縱和渲染 PDF 文件。 憑藉其對 HTML、CSS、JavaScript 和圖像格式的廣泛支持,IronPDF 使 Web 內容和圖像無縫轉換為高質量的 PDF。 它提供多線程和異步支持等功能,以提高性能和擴展性。 此外,IronPDF 提供高級的安全選項,包括加密、數字簽名和密碼保護來保護 PDF 文件。 它全面的類和函數集,用於 PDF 操作、表單處理和文本提取,使其成為各種 PDF 關連任務的多才多藝的解決方案。 總的來說,IronPDF 為開發人員提供了一個可靠和高效的框架,以便在他們的應用程式中進行 PDF 處理。

Foxit PDF SDK 是一個全面且功能豐富的庫,使開發人員擁有先進的 PDF 處理能力。 它提供的工具和功能包括創建、編輯和操縱 PDF 文件。 通過其廣泛的 API ,開發人員可以細粒度地控制 PDF 元素,如文本、圖像、註解和表單字段。 Foxit PDF SDK 提供對各種 PDF 標準的強大支持,保證了兼容性和符合行業規範。 其豐富的特性集包括 PDF 加密、數字簽名和密碼保護,以保護敏感數據。 該 SDK 還提供高性能的渲染能力,允許 PDF 內容的平滑和高效顯示。 通過 Foxit PDF SDK ,開發人員可以構建具有定製工作流程、文檔自動化和無縫集成到其現有系統的複雜 PDF 應用程式。

IronPDF 提供更具成本效益的授權結構,對比於 Foxit PDF SDK ,使之對開發人員更具吸引力。 IronPDF 遵循每位開發人員的授權模型,即一份許可證即可讓整個開發團隊使用庫。 這意味著開發人員可以协同工作在項目上使用 IronPDF ,而不會為每個团队成員產生额外的授權成本。 此外,IronPDF 提供永久使用的選項,讓開發人員可以無限期地使用已購買的版本,而無需為未來更新付費。 相反地,Foxit PDF SDK 运作在基於權力費用模型下,開發人員需要支付依據结合 SDK 中售出的單位数量的費用。 這可能會導致成本增加,尤其是對於用戶基數或銷售量大的應用而言。 因此,IronPDF 的授權結構提供了一個更具成本效益的解決方案,使開发人員可以節省授權費用,同时受益於強大的 PDF 處理能力。

IronPDF 在技術能力方面相對於 Foxit PDF 有幾個優勢。 首先,IronPDF 提供了更簡單和開發者友好型的API,讓它更容易集成和在多個應用程式中運行。 其簡單直觀的API允許流線型PDF處理,減少所需的開發時間和努力。 除此之外,IronPDF 提供了對現代Web技術的強大支持,包括 HTML, CSS, JavaScript 和圖像格式,使網頁內容的無縫轉換成PDF文件。 它還提供了如多线程和异步支持等高级功能,增强了处理大型PDF文件或大批量文档处理的性能和可扩展性。 IronPDF 在加密选项上的灵活性,允许开发人员从不同的算法和密钥长度中进行选择,为额外的安全性定制增加了额外的层。 此外,IronPDF 的授权模式更具成本效益,支持每位开发人员的授权结构和永久使用的選擇,使之對開發人員來說是一個更符合經濟效益的選擇。 總的來說,IronPDF 在易於使用、強大的功能性和成本效益方面表現出色,成為不錯的選擇。

IronPDF 是 Iron Suite 的一部分,這是一個強大的軟體工具集,旨在增强開發能力。 The Iron Suite consists of five products, including IronOCR for optical character recognition, IronPDF for PDF processing, IronBarcode for barcode generation, IronXL for Excel manipulation, and IronWebscraper for web data extraction. 通過購買完整的 Iron Suite ,開發人員可以利用這五個產品的合力,獲得一套全面的工具以滿足各種開發需求,所有這些都只需要兩個單獨產品的成本。

請注意Foxit PDF SDK 是其各自所有者的註冊商標。 本網站與 Foxit PDF SDK 無關、未被其認可亦未被其贊助。 所有產品名稱、徽標和品牌均為其各自所有者的財產。 比較僅供信息參考,並反映撰寫時公開可用的信息。

常見問題解答

Foxit PDF SDK 和 IronPDF 之間有什麼區別?

在 .NET 應用程序中處理 PDF 任務時,IronPDF 和 Foxit PDF SDK 都很受歡迎。 IronPDF 提供卓越的 HTML 到 PDF 轉換、強大的安全功能以及具有成本效益的許可模式,而 Foxit 則為文件格式和 PDF 註釋功能提供了強大的支持。

如何在 .NET 應用程序中將 HTML 轉換為 PDF?

您可以使用 IronPDF 的 RenderHtmlAsPdf 方法將 HTML 字符串轉換為 PDF。此外,您可以使用 RenderHtmlFileAsPdf 轉換 HTML 文件。

IronPDF 的安全功能有哪些?

IronPDF 提供全面的安全功能,包括密碼保護、加密選項、數字簽名和證書管理,以保護 PDF 文件。

IronPDF 如何支持多執行緒和異步操作?

IronPDF 設計用於支持多執行緒和異步操作,允許開發人員在 .NET 應用程序中高效處理多個 PDF 處理任務。

IronPDF 可以用於不同的操作系統嗎?

是的,IronPDF 支持 .NET Standard 和 .NET Core,使其兼容於 Windows、Linux 和 macOS 平台。

使用 IronPDF 創建 PDF 的基本代碼示例是什麼?

使用 IronPDF 的基本示例涉及創建 ChromePdfRenderer 的實例,將 HTML 內容渲染到 PDF 文檔中,並將其保存到磁碟中。

IronPDF 相對於基於訂閱的 PDF SDK 提供了哪些優勢?

IronPDF 提供具有每位開發人員和永久選項的具成本效益的許可模式,提供與基於訂閱的模型相比更實惠的解決方案。

什麼是 Iron Suite?

Iron Suite 是一系列功能強大的開發工具,包括 IronOCR、IronPDF、IronBarcode、IronXL 和 IronWebscraper,旨在提升開發人員的生產力。

Curtis Chau
技術作家

Curtis Chau 擁有卡爾頓大學計算機科學學士學位,專注於前端開發,擅長於 Node.js、TypeScript、JavaScript 和 React。Curtis 熱衷於創建直觀且美觀的用戶界面,喜歡使用現代框架並打造結構良好、視覺吸引人的手冊。

除了開發之外,Curtis 對物聯網 (IoT) 有著濃厚的興趣,探索將硬體和軟體結合的創新方式。在閒暇時間,他喜愛遊戲並構建 Discord 機器人,結合科技與創意的樂趣。