跳過到頁腳內容
產品比較

IronPDF與Docraptor - 全面比較

在現今快節奏的開發環境中,選擇正確的工具從 HTML 產生 PDF,可以在效率和輸出品質上產生顯著的差異。 IronPDF 和 DocRaptor 是這項任務的兩個主要競爭者。 雖然這兩種工具都旨在簡化 HTML 轉換為 PDF 的過程,但它們提供不同的功能、定價模式,以及與 .NET 和其他平台的整合程度。

在本文中,我們將深入詳細比較 IronPDF 和 DocRaptor,強調兩者的優點、限制以及各自的最佳使用案例,協助您決定哪個解決方案最適合您的專案需求。

IronPDF。 和 DocRaptor 概述

IronPDF 提供了在 .NET 應用程式中建立、編輯和管理 PDF 的廣泛功能。 本軟體完全支援 HTML、CSS、JavaScript 和 C#,為開發人員提供高度客製化且強大的工具來處理 PDF。 這個函式庫的設計方便開發人員使用,並提供優異的說明文件,以確保能在 .NET 環境中快速部署且容易使用。

DocRaptor 是一個以雲端為基礎的解決方案,提供 PDF 和 Excel 生成功能,並著重於 Web 應用程式和 API 整合。 DocRaptor 使用 Prince PDF 引擎,支援多種程式語言,包括 .NET,並可將 HTML 轉換為 PDF。 雖然該平台在基本的 PDF 產生方面表現優異,但它需要網際網路連線才能存取其 API,而且缺乏 IronPDF 所提供的客製化與彈性。

跨平台相容性

IronPDF。

IronPDF 以其廣泛的跨平台相容性脫穎而出。 它支援 .NET Framework 內的多種環境,確保在不同平台上的無縫操作。 以下是 IronPDF 的平台兼容性摘要:

  • .NET版本:

    • 完全以 C#、VB.NET、F# 寫成,並支援這些語言。
    • .NET Core(8、7、6、5 和 3.1+)
    • .NET Standard (2.0+)
    • .NET Framework (4.6.2+)
  • 應用環境: IronPDF 可在 Windows、Linux、Mac、Docker、Azure 和 AWS 等各種應用環境中運作。

  • IDE:可與 Microsoft Visual Studio、JetBrains Rider & ReSharper 等 IDE 搭配使用。

  • 作業系統與處理器:支援多種不同的作業系統與處理器,包括 Windows、Mac、Linux、x64、x86、ARM。

如需 IronPDF 兼容性的詳細資訊,請造訪 IronPDF兼容性

猛禽博士

DocRaptor 提供強大的跨平台相容性和 .NET 版本支援,其中包括以下各項:

  • Windows: DocRaptor 在 Windows 環境下運作順暢,可與 .NET 和其他常見開發堆疊良好整合。
  • Linux: DocRaptor 可以在基於 Linux 的環境中使用,因此適用於伺服器端 PDF 生成任務。
  • macOS:使用 macOS 的開發者可以將 DocRaptor 無縫整合到他們的開發流程中。
  • .NET Core: DocRaptor 支援 .NET Core,為在最新的 .NET 生態系統中工作的開發人員提供現代化的跨平台功能。
  • .NET Framework:它也與傳統的 .NET Framework 相容,允許基於舊系統建置的專案受益於其 PDF 生成功能。
  • .NET 5 及更高版本: DocRaptor 與 .NET 5 及更高版本相容,確保在新版 .NET 上工作的開發人員可以放心使用該程式庫,無需擔心相容性問題。

主要功能比較:IronPDF 與 DocRaptor 的 PDF 功能比較。

IronPDF。

  • PDF轉換: IronPDF 可以將 HTML 轉換為 PDF。 IronPDF 完全支援現代網路標準,因此您可以放心,IronPDF 將持續從您的 HTML 內容傳回像素完美的 PDF。 IronPDF 也可以轉換其他格式的 PDF 檔案,例如 DOCX、圖片、RTF 等。

  • PDF 產生:使用 IronPDF,您可以從 URL、ASPX 檔案或 HTML 字串產生 PDF。

  • 安全功能:借助 IronPDF 的安全功能,您可以始终确保任何敏感 PDF 文件的安全。 使用 IronPDF 加密您的 PDF 檔案、設定密碼,以及為 PDF 檔案設定權限。

  • PDF編輯功能:使用 IronPDF,您可以處理現有的 PDF 文件、編輯它們,並輕鬆讀取 PDF 檔案。 IronPDF 提供的編輯功能包括新增頁首和頁尾,在 PDF 頁面上印製文字和圖片,在 PDF 上新增自訂水印,處理 PDF 表單,以及分割或合併 PDF 檔案。

*整合:ASP.NET和 MVC 應用程式無縫整合。

  • PDF 版本支援: 可支援 PDF 版本 1.2-1.7

如需 IronPDF 功能的完整清單,請造訪 IronPDF功能

猛禽博士

DocRaptor 提供一套全面的功能,專為可靠的 HTML 至 PDF 和 HTML 至 Excel 轉換而設計。 以下是它的一些主要功能:

*精確渲染:支援 HTML5、CSS3、JavaScript 和 SVG,確保現代網頁的 PDF 渲染準確無誤。

  • JavaScript 執行:在轉換之前處理 JavaScript,允許動態內容在產生的 PDF 中正確處理和顯示。

*響應式設計支援:支援媒體查詢,使響應式設計能夠適應 PDF 的大小。

  • Excel 匯出:將 HTML 表格轉換為 Excel 電子表格 (.xlsx),可用於產生報表或匯出結構化資料。

*儲存格格式:保留 Excel 輸出的儲存格樣式、字型和其他格式選項。

IronPDF 和 DocRaptor 的頂尖亮點功能比較與程式碼範例。

1.將 HTML 轉換為 PDF

IronPDF:

// Convert HTML to PDF using IronPDF
using IronPdf;

// Enable web security to prevent local disk access or cross-origin requests
Installation.EnableWebSecurity = true;

// Instantiate the PDF renderer
var renderer = new ChromePdfRenderer();

// Create a PDF from an HTML string 
var pdf = renderer.RenderHtmlAsPdf("<h1>Hello World!</h1>");

// Export to a file or Stream
pdf.SaveAs("output.pdf");

// Advanced Example with HTML Assets
var myAdvancedPdf = renderer.RenderHtmlAsPdf("<img src='icons/iron.png'>", @"C:\site\assets\");
myAdvancedPdf.SaveAs("html-with-assets.pdf");
// Convert HTML to PDF using IronPDF
using IronPdf;

// Enable web security to prevent local disk access or cross-origin requests
Installation.EnableWebSecurity = true;

// Instantiate the PDF renderer
var renderer = new ChromePdfRenderer();

// Create a PDF from an HTML string 
var pdf = renderer.RenderHtmlAsPdf("<h1>Hello World!</h1>");

// Export to a file or Stream
pdf.SaveAs("output.pdf");

// Advanced Example with HTML Assets
var myAdvancedPdf = renderer.RenderHtmlAsPdf("<img src='icons/iron.png'>", @"C:\site\assets\");
myAdvancedPdf.SaveAs("html-with-assets.pdf");
' Convert HTML to PDF using IronPDF
Imports IronPdf

' Enable web security to prevent local disk access or cross-origin requests
Installation.EnableWebSecurity = True

' Instantiate the PDF renderer
Dim renderer = New ChromePdfRenderer()

' Create a PDF from an HTML string 
Dim pdf = renderer.RenderHtmlAsPdf("<h1>Hello World!</h1>")

' Export to a file or Stream
pdf.SaveAs("output.pdf")

' Advanced Example with HTML Assets
Dim myAdvancedPdf = renderer.RenderHtmlAsPdf("<img src='icons/iron.png'>", "C:\site\assets\")
myAdvancedPdf.SaveAs("html-with-assets.pdf")
$vbLabelText   $csharpLabel

DocRaptor:

using DocRaptor.Client;
using DocRaptor.Model;
using DocRaptor.Api;
using System;
using System.IO;

// Example of using DocRaptor to convert HTML and JavaScript to PDF
DocApi docraptor = new DocApi();
docraptor.Configuration.Username = "YOUR_API_KEY_HERE";

try
{
    Doc doc = new Doc(
        name: "html-and-javascript",
        test: true, // Test flag to indicate trial mode
        documentType: Doc.DocumentTypeEnum.Pdf, // Specify document type
        documentContent: System.IO.File.ReadAllText(@"html-and-javascript-content.html"), // Load HTML content from file
        javascript: true // Enable JavaScript execution
    );

    byte[] document = docraptor.CreateDoc(doc);
    File.WriteAllBytes("html-and-javascript.pdf", document);
    Console.WriteLine("Successfully created html-and-javascript.pdf!");
}
catch (DocRaptor.Client.ApiException error)
{
    Console.Write(error.ErrorContent);
}
using DocRaptor.Client;
using DocRaptor.Model;
using DocRaptor.Api;
using System;
using System.IO;

// Example of using DocRaptor to convert HTML and JavaScript to PDF
DocApi docraptor = new DocApi();
docraptor.Configuration.Username = "YOUR_API_KEY_HERE";

try
{
    Doc doc = new Doc(
        name: "html-and-javascript",
        test: true, // Test flag to indicate trial mode
        documentType: Doc.DocumentTypeEnum.Pdf, // Specify document type
        documentContent: System.IO.File.ReadAllText(@"html-and-javascript-content.html"), // Load HTML content from file
        javascript: true // Enable JavaScript execution
    );

    byte[] document = docraptor.CreateDoc(doc);
    File.WriteAllBytes("html-and-javascript.pdf", document);
    Console.WriteLine("Successfully created html-and-javascript.pdf!");
}
catch (DocRaptor.Client.ApiException error)
{
    Console.Write(error.ErrorContent);
}
Imports DocRaptor.Client
Imports DocRaptor.Model
Imports DocRaptor.Api
Imports System
Imports System.IO

' Example of using DocRaptor to convert HTML and JavaScript to PDF
Private docraptor As New DocApi()
docraptor.Configuration.Username = "YOUR_API_KEY_HERE"

Try
	Dim doc As New Doc(name:= "html-and-javascript", test:= True, documentType:= Doc.DocumentTypeEnum.Pdf, documentContent:= System.IO.File.ReadAllText("html-and-javascript-content.html"), javascript:= True)

	Dim document() As Byte = docraptor.CreateDoc(doc)
	File.WriteAllBytes("html-and-javascript.pdf", document)
	Console.WriteLine("Successfully created html-and-javascript.pdf!")
Catch [error] As DocRaptor.Client.ApiException
	Console.Write([error].ErrorContent)
End Try
$vbLabelText   $csharpLabel

IronPDF 可輕鬆處理 HTML 至 PDF 的轉換,其對現代 Web 標準的全面支援可確保您的 PDF 文件完美無瑕。 DocRaptor 使用基於 API 的方式,需要 API 金鑰和基於雲端的執行來將 HTML 轉換為 PDF。

2.加密 PDF 檔案

IronPDF:

using IronPdf;
using System;

// Load an existing PDF with a password
var pdf = PdfDocument.FromFile("encrypted.pdf", "password");

// Edit file metadata
pdf.MetaData.Author = "Satoshi Nakamoto";
pdf.MetaData.Keywords = "SEO, Friendly";
pdf.MetaData.ModifiedDate = DateTime.Now;

// Edit file security settings
pdf.SecuritySettings.RemovePasswordsAndEncryption();
pdf.SecuritySettings.MakePdfDocumentReadOnly("secret-key");
pdf.SecuritySettings.AllowUserAnnotations = false;
pdf.SecuritySettings.AllowUserCopyPasteContent = false;
pdf.SecuritySettings.AllowUserFormData = false;
pdf.SecuritySettings.AllowUserPrinting = IronPdf.Security.PdfPrintSecurity.FullPrintRights;

// Change or set the document encryption password
pdf.Password = "my-password";
pdf.SaveAs("secured.pdf");
using IronPdf;
using System;

// Load an existing PDF with a password
var pdf = PdfDocument.FromFile("encrypted.pdf", "password");

// Edit file metadata
pdf.MetaData.Author = "Satoshi Nakamoto";
pdf.MetaData.Keywords = "SEO, Friendly";
pdf.MetaData.ModifiedDate = DateTime.Now;

// Edit file security settings
pdf.SecuritySettings.RemovePasswordsAndEncryption();
pdf.SecuritySettings.MakePdfDocumentReadOnly("secret-key");
pdf.SecuritySettings.AllowUserAnnotations = false;
pdf.SecuritySettings.AllowUserCopyPasteContent = false;
pdf.SecuritySettings.AllowUserFormData = false;
pdf.SecuritySettings.AllowUserPrinting = IronPdf.Security.PdfPrintSecurity.FullPrintRights;

// Change or set the document encryption password
pdf.Password = "my-password";
pdf.SaveAs("secured.pdf");
Imports IronPdf
Imports System

' Load an existing PDF with a password
Private pdf = PdfDocument.FromFile("encrypted.pdf", "password")

' Edit file metadata
pdf.MetaData.Author = "Satoshi Nakamoto"
pdf.MetaData.Keywords = "SEO, Friendly"
pdf.MetaData.ModifiedDate = DateTime.Now

' Edit file security settings
pdf.SecuritySettings.RemovePasswordsAndEncryption()
pdf.SecuritySettings.MakePdfDocumentReadOnly("secret-key")
pdf.SecuritySettings.AllowUserAnnotations = False
pdf.SecuritySettings.AllowUserCopyPasteContent = False
pdf.SecuritySettings.AllowUserFormData = False
pdf.SecuritySettings.AllowUserPrinting = IronPdf.Security.PdfPrintSecurity.FullPrintRights

' Change or set the document encryption password
pdf.Password = "my-password"
pdf.SaveAs("secured.pdf")
$vbLabelText   $csharpLabel

DocRaptor: DocRaptor 本身不支援 PDF 加密功能。

IronPDF 提供 內建加密元資料和安全控制,而 DocRaptor 則需要第三方工具才能實現類似功能。

3.重編 PDF 內容

IronPDF:

using IronPdf;

// Load the PDF and redact specified text
PdfDocument pdf = PdfDocument.FromFile("novel.pdf");
pdf.RedactTextOnAllPages("are");
pdf.SaveAs("redacted.pdf");
using IronPdf;

// Load the PDF and redact specified text
PdfDocument pdf = PdfDocument.FromFile("novel.pdf");
pdf.RedactTextOnAllPages("are");
pdf.SaveAs("redacted.pdf");
Imports IronPdf

' Load the PDF and redact specified text
Private pdf As PdfDocument = PdfDocument.FromFile("novel.pdf")
pdf.RedactTextOnAllPages("are")
pdf.SaveAs("redacted.pdf")
$vbLabelText   $csharpLabel

DocRaptor 不支援刪節功能。

IronPDF 提供 原生編輯,這是 DocRaptor 所缺乏的一項對於法律和機密文件的重要功能。

4.數位簽章 PDF 文件

IronPDF:

using IronPdf;
using IronPdf.Signing;
using System.Security.Cryptography.X509Certificates;

// Initialize PDF renderer and create a PDF document
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>foo</h1>");

// Load the certificate for signing
X509Certificate2 cert = new X509Certificate2("IronSoftware.pfx", "123456", X509KeyStorageFlags.Exportable);

// Create a PdfSignature object
var sig = new PdfSignature(cert);

// Sign the PDF document
pdf.Sign(sig);
pdf.SaveAs("signed.pdf");
using IronPdf;
using IronPdf.Signing;
using System.Security.Cryptography.X509Certificates;

// Initialize PDF renderer and create a PDF document
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>foo</h1>");

// Load the certificate for signing
X509Certificate2 cert = new X509Certificate2("IronSoftware.pfx", "123456", X509KeyStorageFlags.Exportable);

// Create a PdfSignature object
var sig = new PdfSignature(cert);

// Sign the PDF document
pdf.Sign(sig);
pdf.SaveAs("signed.pdf");
Imports IronPdf
Imports IronPdf.Signing
Imports System.Security.Cryptography.X509Certificates

' Initialize PDF renderer and create a PDF document
Private renderer As New ChromePdfRenderer()
Private pdf As PdfDocument = renderer.RenderHtmlAsPdf("<h1>foo</h1>")

' Load the certificate for signing
Private cert As New X509Certificate2("IronSoftware.pfx", "123456", X509KeyStorageFlags.Exportable)

' Create a PdfSignature object
Private sig = New PdfSignature(cert)

' Sign the PDF document
pdf.Sign(sig)
pdf.SaveAs("signed.pdf")
$vbLabelText   $csharpLabel

DocRaptor 本身不支援 PDF 簽署。

IronPDF 提供內建機制,可對 PDF 進行數位簽章,使其在驗證和法律文件方面更具優勢。 DocRaptor 缺乏這項關鍵功能,因此此程式庫的使用者需要下載其他程式庫才能執行這項任務。

5.套用自訂水印。

IronPDF:

using IronPdf;

// Stamper to apply a watermark on a PDF
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf");
pdf.ApplyWatermark("<h2 style='color:red'>SAMPLE</h2>", 30, IronPdf.Editing.VerticalAlignment.Middle, IronPdf.Editing.HorizontalAlignment.Center);
pdf.SaveAs(@"C:\Path\To\Watermarked.pdf");
using IronPdf;

// Stamper to apply a watermark on a PDF
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf");
pdf.ApplyWatermark("<h2 style='color:red'>SAMPLE</h2>", 30, IronPdf.Editing.VerticalAlignment.Middle, IronPdf.Editing.HorizontalAlignment.Center);
pdf.SaveAs(@"C:\Path\To\Watermarked.pdf");
Imports IronPdf

' Stamper to apply a watermark on a PDF
Private renderer = New ChromePdfRenderer()
Private pdf = renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf")
pdf.ApplyWatermark("<h2 style='color:red'>SAMPLE</h2>", 30, IronPdf.Editing.VerticalAlignment.Middle, IronPdf.Editing.HorizontalAlignment.Center)
pdf.SaveAs("C:\Path\To\Watermarked.pdf")
$vbLabelText   $csharpLabel

DocRaptor:

using DocRaptor.Client;
using DocRaptor.Model;
using DocRaptor.Api;
using System;
using System.IO;

class DocRaptorExample
{
    static void Main(string[] args)
    {
        DocApi docraptor = new DocApi();
        docraptor.Configuration.Username = "YOUR_API_KEY_HERE";

        try
        {
            Doc doc = new Doc(
                name: "text-based-watermark",
                test: false, // Test documents are free but watermarked
                documentType: Doc.DocumentTypeEnum.Pdf,
                documentContent: System.IO.File.ReadAllText(@"text-based-watermark-content.html") 
            );

            byte[] document = docraptor.CreateDoc(doc);
            File.WriteAllBytes("text-based-watermark.pdf", document);
            Console.WriteLine("Successfully created text-based-watermark.pdf!");
        } catch (DocRaptor.Client.ApiException error) {
            Console.Write(error.ErrorContent);
        }
    }
}
using DocRaptor.Client;
using DocRaptor.Model;
using DocRaptor.Api;
using System;
using System.IO;

class DocRaptorExample
{
    static void Main(string[] args)
    {
        DocApi docraptor = new DocApi();
        docraptor.Configuration.Username = "YOUR_API_KEY_HERE";

        try
        {
            Doc doc = new Doc(
                name: "text-based-watermark",
                test: false, // Test documents are free but watermarked
                documentType: Doc.DocumentTypeEnum.Pdf,
                documentContent: System.IO.File.ReadAllText(@"text-based-watermark-content.html") 
            );

            byte[] document = docraptor.CreateDoc(doc);
            File.WriteAllBytes("text-based-watermark.pdf", document);
            Console.WriteLine("Successfully created text-based-watermark.pdf!");
        } catch (DocRaptor.Client.ApiException error) {
            Console.Write(error.ErrorContent);
        }
    }
}
Imports DocRaptor.Client
Imports DocRaptor.Model
Imports DocRaptor.Api
Imports System
Imports System.IO

Friend Class DocRaptorExample
	Shared Sub Main(ByVal args() As String)
		Dim docraptor As New DocApi()
		docraptor.Configuration.Username = "YOUR_API_KEY_HERE"

		Try
			Dim doc As New Doc(name:= "text-based-watermark", test:= False, documentType:= Doc.DocumentTypeEnum.Pdf, documentContent:= System.IO.File.ReadAllText("text-based-watermark-content.html"))

			Dim document() As Byte = docraptor.CreateDoc(doc)
			File.WriteAllBytes("text-based-watermark.pdf", document)
			Console.WriteLine("Successfully created text-based-watermark.pdf!")
		Catch [error] As DocRaptor.Client.ApiException
			Console.Write([error].ErrorContent)
		End Try
	End Sub
End Class
$vbLabelText   $csharpLabel

IronPDF 提供完整的水印功能,僅需幾行程式碼即可建立和套用自訂水印,而且這些水印可套用至新的或現有的 PDF 檔案。 然而,DocRaptor 要求在將 HTML 內容轉換為 PDF 之前,先使用 HTML 和 CSS 加入水印。

6.沖印文字和圖片

IronPDF:

using IronPdf;
using IronPdf.Editing;

// Initialize PDF renderer and create a basic HTML-based PDF
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>Example HTML Document!</h1>");

// Create a text stamper
TextStamper textStamper = new TextStamper()
{
    Text = "Text Stamper!",
    FontFamily = "Bungee Spice",
    UseGoogleFont = true,
    FontSize = 30,
    IsBold = true,
    IsItalic = true,
    VerticalAlignment = VerticalAlignment.Top,
};

// Apply the text stamper to the PDF
pdf.ApplyStamp(textStamper);
pdf.SaveAs("stampText.pdf");
using IronPdf;
using IronPdf.Editing;

// Initialize PDF renderer and create a basic HTML-based PDF
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>Example HTML Document!</h1>");

// Create a text stamper
TextStamper textStamper = new TextStamper()
{
    Text = "Text Stamper!",
    FontFamily = "Bungee Spice",
    UseGoogleFont = true,
    FontSize = 30,
    IsBold = true,
    IsItalic = true,
    VerticalAlignment = VerticalAlignment.Top,
};

// Apply the text stamper to the PDF
pdf.ApplyStamp(textStamper);
pdf.SaveAs("stampText.pdf");
Imports IronPdf
Imports IronPdf.Editing

' Initialize PDF renderer and create a basic HTML-based PDF
Private renderer As New ChromePdfRenderer()
Private pdf As PdfDocument = renderer.RenderHtmlAsPdf("<h1>Example HTML Document!</h1>")

' Create a text stamper
Private textStamper As New TextStamper() With {
	.Text = "Text Stamper!",
	.FontFamily = "Bungee Spice",
	.UseGoogleFont = True,
	.FontSize = 30,
	.IsBold = True,
	.IsItalic = True,
	.VerticalAlignment = VerticalAlignment.Top
}

' Apply the text stamper to the PDF
pdf.ApplyStamp(textStamper)
pdf.SaveAs("stampText.pdf")
$vbLabelText   $csharpLabel

DocRaptor 缺乏在 PDF 上標示文字和圖像的原生功能。

IronPDF 允許在 標示文字和影像時進行詳細的自訂,使其成為文件註解和品牌塑造的優越選擇。 DocRaptor 缺乏對文字和圖像戳記的任何原生支援,水印是最接近的支援。

7. DOCX 至 PDF

IronPDF:

using IronPdf;

// Instantiate a renderer specifically for DOCX files
DocxToPdfRenderer renderer = new DocxToPdfRenderer();

// Render a PDF document from a DOCX file
PdfDocument pdf = renderer.RenderDocxAsPdf("Modern-chronological-resume.docx");

// Save the resulting PDF
pdf.SaveAs("pdfFromDocx.pdf");
using IronPdf;

// Instantiate a renderer specifically for DOCX files
DocxToPdfRenderer renderer = new DocxToPdfRenderer();

// Render a PDF document from a DOCX file
PdfDocument pdf = renderer.RenderDocxAsPdf("Modern-chronological-resume.docx");

// Save the resulting PDF
pdf.SaveAs("pdfFromDocx.pdf");
Imports IronPdf

' Instantiate a renderer specifically for DOCX files
Private renderer As New DocxToPdfRenderer()

' Render a PDF document from a DOCX file
Private pdf As PdfDocument = renderer.RenderDocxAsPdf("Modern-chronological-resume.docx")

' Save the resulting PDF
pdf.SaveAs("pdfFromDocx.pdf")
$vbLabelText   $csharpLabel

DocRaptor:

不支援 DOCX 至 PDF 的原生轉換。

IronPDF 為 DOCX 至 PDF 的轉換提供了更順暢、更原生的流程,而不需要像 DocRaptor 之類的任何外部函式庫,因為 DocRaptor 缺乏對這項工作的內建支援。

程式碼範例比較摘要

IronPDF vs. DocRaptor

若要進一步瞭解 IronPDF 所提供的豐富功能,並觀看它們的實際應用,請查看 IronPDF 使用指南,這些指南會深入介紹每項功能,探討它們如何運作,並提供您成為 PDF 專家所需的技能。

Bootstrap 與現代 CSS 架構渲染支援。

使用 CSS 框架(如 Bootstrap、Tailwind 和 Foundation)建立的現代網路應用程式,需要能夠準確保留這些框架佈局的 PDF 生成工具。 這項能力對於維持網頁和 PDF 輸出的設計一致性至關重要。

IronPDF。:原生 Bootstrap 和 Framework 支援。

IronPDF 的 Chromium 引擎提供對所有現代 CSS 框架的完整支援:

  • Bootstrap 5:完全支援 Flexbox 和 CSS Grid,以及所有響應式工具 Bootstrap 4:完整的卡片系統、導航和表單元件
  • Tailwind CSS:所有實用類別和響應式修飾符 -基礎:完整的網格和組件系統 -現代 CSS3: Flexbox、Grid、自訂屬性、動畫和變換
  • JavaScript 支援:框架互動的完整執行

真實世界驗證:Bootstrap首頁官方範本可在瀏覽器上準確轉換。

程式碼範例:使用 Bootstrap 的常見問題手動條

using IronPdf;

var renderer = new ChromePdfRenderer();

string bootstrapFAQ = @"
<!DOCTYPE html>
<html>
<head>
    <link href='https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css' rel='stylesheet'>
</head>
<body>
    <div class='container my-5'>
        <h1 class='text-center mb-5'>Frequently Asked Questions</h1>

        <div class='row'>
            <div class='col-lg-8 mx-auto'>
                <div class='accordion' id='faqAccordion'>
                    <div class='accordion-item'>
                        <h2 class='accordion-header'></h2>
                            <button class='accordion-button' type='button'>
                                What file formats do you support?
                            </button>
                        </h2>
                        <div class='accordion-collapse collapse show'>
                            <div class='accordion-body'>
                                <strong>We support a wide range of formats:</strong> HTML, URL-based conversion, image to PDF,
                                DOCX to PDF, and more. Our Chromium engine ensures accurate rendering of modern web standards.
                            </div>
                        </div>
                    </div>

                    <div class='accordion-item'>
                        <h2 class='accordion-header'></h2>
                            <button class='accordion-button collapsed' type='button'>
                                Do you support responsive designs?
                            </button>
                        </h2>
                        <div class='accordion-collapse collapse'>
                            <div class='accordion-body'>
                                Yes! Our rendering engine fully supports responsive CSS frameworks including Bootstrap, Tailwind,
                                and custom responsive designs. You can specify viewport dimensions and paper sizes to control output.
                            </div>
                        </div>
                    </div>

                    <div class='accordion-item'>
                        <h2 class='accordion-header'></h2>
                            <button class='accordion-button collapsed' type='button'>
                                What about JavaScript rendering?
                            </button>
                        </h2>
                        <div class='accordion-collapse collapse'>
                            <div class='accordion-body'>
                                <div class='alert alert-info mb-3'>
                                    <strong>Full JavaScript Support:</strong> IronPDF executes JavaScript before PDF generation.
                                </div>
                                You can configure render delays to ensure dynamic content loads completely. This includes AJAX calls,
                                React/Vue/Angular components, and dynamic chart libraries.
                            </div>
                        </div>
                    </div>

                    <div class='accordion-item'>
                        <h2 class='accordion-header'></h2>
                            <button class='accordion-button collapsed' type='button'>
                                How does pricing work?
                            </button>
                        </h2>
                        <div class='accordion-collapse collapse'>
                            <div class='accordion-body'>
                                We offer transparent per-developer licensing starting at competitive rates. No per-document fees,
                                no hidden costs. Pricing includes all features, updates, and support for one year.
                                <a href='/licensing/' class='btn btn-sm btn-primary mt-2'>View Pricing Details</a>
                            </div>
                        </div>
                    </div>
                </div>

                <div class='card mt-5 bg-light'>
                    <div class='card-body'>
                        <h5 class='card-title'>Still have questions?</h5>
                        <p class='card-text'>Our support team is here to help you get started.</p>
                        <a href='#' class='btn btn-primary'>Contact Support</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>";

var pdf = renderer.RenderHtmlAsPdf(bootstrapFAQ);
pdf.SaveAs("faq-page.pdf");
using IronPdf;

var renderer = new ChromePdfRenderer();

string bootstrapFAQ = @"
<!DOCTYPE html>
<html>
<head>
    <link href='https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css' rel='stylesheet'>
</head>
<body>
    <div class='container my-5'>
        <h1 class='text-center mb-5'>Frequently Asked Questions</h1>

        <div class='row'>
            <div class='col-lg-8 mx-auto'>
                <div class='accordion' id='faqAccordion'>
                    <div class='accordion-item'>
                        <h2 class='accordion-header'></h2>
                            <button class='accordion-button' type='button'>
                                What file formats do you support?
                            </button>
                        </h2>
                        <div class='accordion-collapse collapse show'>
                            <div class='accordion-body'>
                                <strong>We support a wide range of formats:</strong> HTML, URL-based conversion, image to PDF,
                                DOCX to PDF, and more. Our Chromium engine ensures accurate rendering of modern web standards.
                            </div>
                        </div>
                    </div>

                    <div class='accordion-item'>
                        <h2 class='accordion-header'></h2>
                            <button class='accordion-button collapsed' type='button'>
                                Do you support responsive designs?
                            </button>
                        </h2>
                        <div class='accordion-collapse collapse'>
                            <div class='accordion-body'>
                                Yes! Our rendering engine fully supports responsive CSS frameworks including Bootstrap, Tailwind,
                                and custom responsive designs. You can specify viewport dimensions and paper sizes to control output.
                            </div>
                        </div>
                    </div>

                    <div class='accordion-item'>
                        <h2 class='accordion-header'></h2>
                            <button class='accordion-button collapsed' type='button'>
                                What about JavaScript rendering?
                            </button>
                        </h2>
                        <div class='accordion-collapse collapse'>
                            <div class='accordion-body'>
                                <div class='alert alert-info mb-3'>
                                    <strong>Full JavaScript Support:</strong> IronPDF executes JavaScript before PDF generation.
                                </div>
                                You can configure render delays to ensure dynamic content loads completely. This includes AJAX calls,
                                React/Vue/Angular components, and dynamic chart libraries.
                            </div>
                        </div>
                    </div>

                    <div class='accordion-item'>
                        <h2 class='accordion-header'></h2>
                            <button class='accordion-button collapsed' type='button'>
                                How does pricing work?
                            </button>
                        </h2>
                        <div class='accordion-collapse collapse'>
                            <div class='accordion-body'>
                                We offer transparent per-developer licensing starting at competitive rates. No per-document fees,
                                no hidden costs. Pricing includes all features, updates, and support for one year.
                                <a href='/licensing/' class='btn btn-sm btn-primary mt-2'>View Pricing Details</a>
                            </div>
                        </div>
                    </div>
                </div>

                <div class='card mt-5 bg-light'>
                    <div class='card-body'>
                        <h5 class='card-title'>Still have questions?</h5>
                        <p class='card-text'>Our support team is here to help you get started.</p>
                        <a href='#' class='btn btn-primary'>Contact Support</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>";

var pdf = renderer.RenderHtmlAsPdf(bootstrapFAQ);
pdf.SaveAs("faq-page.pdf");
Imports IronPdf

Dim renderer As New ChromePdfRenderer()

Dim bootstrapFAQ As String = "
<!DOCTYPE html>
<html>
<head>
    <link href='https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css' rel='stylesheet'>
</head>
<body>
    <div class='container my-5'>
        <h1 class='text-center mb-5'>Frequently Asked Questions</h1>

        <div class='row'>
            <div class='col-lg-8 mx-auto'>
                <div class='accordion' id='faqAccordion'>
                    <div class='accordion-item'>
                        <h2 class='accordion-header'></h2>
                            <button class='accordion-button' type='button'>
                                What file formats do you support?
                            </button>
                        </h2>
                        <div class='accordion-collapse collapse show'>
                            <div class='accordion-body'>
                                <strong>We support a wide range of formats:</strong> HTML, URL-based conversion, image to PDF,
                                DOCX to PDF, and more. Our Chromium engine ensures accurate rendering of modern web standards.
                            </div>
                        </div>
                    </div>

                    <div class='accordion-item'>
                        <h2 class='accordion-header'></h2>
                            <button class='accordion-button collapsed' type='button'>
                                Do you support responsive designs?
                            </button>
                        </h2>
                        <div class='accordion-collapse collapse'>
                            <div class='accordion-body'>
                                Yes! Our rendering engine fully supports responsive CSS frameworks including Bootstrap, Tailwind,
                                and custom responsive designs. You can specify viewport dimensions and paper sizes to control output.
                            </div>
                        </div>
                    </div>

                    <div class='accordion-item'>
                        <h2 class='accordion-header'></h2>
                            <button class='accordion-button collapsed' type='button'>
                                What about JavaScript rendering?
                            </button>
                        </h2>
                        <div class='accordion-collapse collapse'>
                            <div class='accordion-body'>
                                <div class='alert alert-info mb-3'>
                                    <strong>Full JavaScript Support:</strong> IronPDF executes JavaScript before PDF generation.
                                </div>
                                You can configure render delays to ensure dynamic content loads completely. This includes AJAX calls,
                                React/Vue/Angular components, and dynamic chart libraries.
                            </div>
                        </div>
                    </div>

                    <div class='accordion-item'>
                        <h2 class='accordion-header'></h2>
                            <button class='accordion-button collapsed' type='button'>
                                How does pricing work?
                            </button>
                        </h2>
                        <div class='accordion-collapse collapse'>
                            <div class='accordion-body'>
                                We offer transparent per-developer licensing starting at competitive rates. No per-document fees,
                                no hidden costs. Pricing includes all features, updates, and support for one year.
                                <a href='/licensing/' class='btn btn-sm btn-primary mt-2'>View Pricing Details</a>
                            </div>
                        </div>
                    </div>
                </div>

                <div class='card mt-5 bg-light'>
                    <div class='card-body'>
                        <h5 class='card-title'>Still have questions?</h5>
                        <p class='card-text'>Our support team is here to help you get started.</p>
                        <a href='#' class='btn btn-primary'>Contact Support</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>"

Dim pdf = renderer.RenderHtmlAsPdf(bootstrapFAQ)
pdf.SaveAs("faq-page.pdf")
$vbLabelText   $csharpLabel

輸出:一個專業的 FAQ 頁面,包含 Bootstrap 的手風琴組件、警告框、卡片樣式和響應式網格——所有內容都在 PDF 中準確呈現。

猛禽博士:良好的 Bootstrap 支援與 API 複雜性。

DocRaptor 是一項雲端服務,使用具有良好 CSS 支援的 Prince XML 渲染引擎:

  • Bootstrap 4/5 支援:對 Bootstrap 佈局的支援整體良好 Prince XML Engine:專業級 HTML/CSS 渲染引擎
  • CSS3 特性:強大的 flexbox 和現代 CSS 支持
  • JavaScript 的限制:與完整瀏覽器相比,JavaScript 執行功能有限。 -雲端依賴性:所有轉換都需要網路連線和 API 呼叫

DocRaptor的關鍵考慮因素: -基於 API:所有轉換均透過 HTTP API 呼叫 DocRaptor 伺服器完成。 -需要連網:無法離線或在實體隔離環境中產生 PDF 文件 -按文件計費:與 IronPDF 按開發者收費的模式不同,DocRaptor 會依文件收費。 -資料隱私:傳送到外部伺服器處理的 HTML 內容 -批量成本:高容量應用程式可能會產生高昂的持續 API 成本。

開發影響:雖然 DocRaptor 對 Bootstrap 的支援很好,但基於雲端的架構引入了一些維運的考量: 1.所有 PDF 的生成都取決於外部服務的可用性 2.大量翻譯時,每份文件的成本可能會迅速攀升 3.敏感內容需要評估資料處理政策 4.每次轉換的網路往返所帶來的延遲

對於需要內部處理、離線功能或大量文件產生的應用程式,IronPDF 的本機處理模式可能提供更好的長期價值與控制。

有關 Bootstrap 框架的最佳實作,請參閱 Bootstrap & Flexbox CSS 指南

定價與授權:IronPDF vs. DocRaptor

IronPDF。

IronPDF有不同的等級和購買授權的附加功能。 開發人員也可以購買 Iron Suite,只需購買兩套,即可使用 Iron Software 的所有產品。 如果您尚未準備好購買授權,IronPDF 提供 免費試用,讓您可以在承諾購買授權之前,探索它所提供的所有功能。

定價(截至 2025 年):

  • 永久授權:根據您的團隊規模、專案需求和地點數量,提供一系列永久授權。 每種授權類型都附有電子郵件支援。

  • Lite License: 此 Lite License 支援一位開發人員、一個地點和一個專案。 價格請洽詢。

  • Plus 許可證:支援三個開發者、三個地點和三個項目,這是比精簡版許可證更高一級的許可證,費用為 $1,499。 Plus License 除了提供基本的電子郵件支援外,還提供聊天支援和電話支援。

*專業版授權:此授權適用於較大的團隊,支援十名開發人員、十個地點和十個項目,適用於 $2,999。 它提供與前幾層相同的聯絡支援管道,但也提供螢幕分享支援。

*免版稅再分發: IronPDF 的許可協議還提供免版稅再分發保障,需額外付費 $2,999

*不間斷的產品支援: IronPDF 提供持續的產品更新、安全功能升級以及來自其工程團隊的支持,您可以選擇每年支付 $1,499,或一次性購買 $2,999 即可獲得 5 年的保障。

IronPDF 定價

猛禽博士

DocRaptor 根據用量提供多種定價選項。 起始價格為每月 $15,以使用量為基礎,也就是說費用會隨著您產生的文件量而增加。 他們也提供免費試用服務,以便在承諾使用付費計劃之前測試服務。

文件和支援:IronPDF vs. DocRaptor

IronPDF。

IronPDF 擅長於提供廣泛的文件和支援:

  • 全面的說明文件: 涵蓋所有功能的廣泛且易於使用的說明文件。
  • 24/5支援:提供積極的工程師支援。
  • 視訊教學:YouTube 上提供了分步視訊指南。
  • 社群論壇:參與社群以獲得更多支援。
  • 定期更新:每月進行產品更新,以確保提供最新的功能和安全修補程式。
  • PDF API 參考:提供 API 參考,讓您可以充分利用我們的工具所提供的功能。

如需更多資訊,請參閱 IronPDF 廣泛的 說明文件,並請造訪 Iron Software YouTube 頻道

猛禽博士

  • API 參考:詳細介紹如何將 DocRaptor 與各種程式語言集成,涵蓋 PDF 和 Excel 生成。 *入門指南:*逐步教程,幫助新使用者設定和使用 DocRaptor 進行 HTML 到 PDF 的轉換。 客戶端程式庫:**流行語言的程式碼範例和函式庫,包括 Java、C#、Python、PHP、Ruby 和 Node.js。 *電子郵件支援:可提供技術協助或與服務相關的諮詢。

結論

總而言之,IronPDF和 DocRaptor 都提供了從 HTML 產生 PDF 的強大解決方案,但它們迎合了不同的受眾和專案需求。 IronPDF for .NET 的優勢在於與 .NET 環境的無縫整合,提供廣泛的客製化選項和離線處理功能。 它非常適合在 .NET Framework 內工作、需要精確控制 PDF 建立與操作的開發人員。 另一方面,DocRaptor 以其雲端模式脫穎而出,確保符合 PDF/A 標準,並提供簡單的 API 供跨平台使用,對於需要跨多種程式語言可靠、可擴充的文件產生的專案而言,DocRaptor 是絕佳的選擇。

最終,您在 IronPDF 和 DocRaptor 之間的選擇應該取決於您的開發堆疊、所需的控制層級,以及您偏好雲端或內部部署解決方案。

請注意DocRaptor 是其各自所有者的註冊商標。 本網站與 DocRaptor 無任何關聯、背書或贊助。 所有產品名稱、標誌和品牌均為其各自擁有者的財產。 比較僅供參考,反映了撰寫時的公開信息。

常見問題解答

怎樣在 C# 中將 HTML 轉換為 PDF?

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

使用 .NET 庫生成 PDF 有哪些優勢?

使用像 IronPDF 這樣的 .NET 庫來生成 PDF 可以與 .NET 應用程式無縫整合。它提供全面的 PDF 創建、編輯和管理功能,並支持各種 .NET 版本和作業系統。

我可以使用 .NET PDF 工具編輯現有 PDF 嗎?

可以,使用 IronPDF,您可以透過其豐富的 API 集編輯現有的 PDF,方法是在 PDF 中添加新內容、修改文字、插入圖像或應用註釋。

使用 .NET PDF 庫來保護 PDF 是否可行?

IronPDF 允許您使用加密和數字簽名保護 PDF,提供增強的文件安全性和真實性。

雲端 PDF 處理和離線 PDF 處理有什麼不同?

以 DocRaptor 為例的雲端 PDF 處理需要網際網路連線,並通過雲中的 API 執行任務。像 IronPDF 這樣的離線處理則允許您在本地環境中直接生成和操作 PDF,無需依賴網際網路。

DocRaptor 如何處理網路應用程式的 PDF 生成?

DocRaptor 使用雲端 API 方法,要求開發人員利用 API 金鑰將 HTML 轉換為網路應用程式中的 PDF,處理由 Prince PDF 引擎完成。

IronPDF 支持哪些平台進行 PDF 生成?

IronPDF 與多種平台相容,包括 Windows、Linux、macOS、Docker、Azure 和 AWS。它支持 .NET Core、.NET Standard 和 .NET Framework 應用程式。

我可以使用 .NET PDF 庫將 DOCX 文件轉換為 PDF 嗎?

可以,IronPDF 提供了一個將 DOCX 文件轉換為 PDF 的簡便過程,無需外部庫,為 .NET 開發人員提供無縫體驗。

IronPDF 對於 .NET 開發的關鍵功能是什麼?

IronPDF 的關鍵功能包括 HTML 到 PDF 轉換、PDF 編輯、文件加密安全、數字簽名、詳細的標記和與 ASP.NET 應用程式的整合。

IronPDF 適合大量 PDF 處理嗎?

是的,IronPDF 被設計為高效處理大量 PDF,非常適合需要穩定且可擴展文檔管理解決方案的企業應用程式。

Curtis Chau
技術作家

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

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

鋼鐵支援團隊

我們每週 5 天,每天 24 小時在線上。
聊天
電子郵件
打電話給我