跳至页脚内容
产品比较

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集成。 通过Prince PDF引擎,DocRaptor支持多种编程语言,包括.NET,并实现HTML到PDF的转换。 虽然该平台在基本PDF生成方面表现优异,但需要互联网连接来访问其API,并且缺乏IronPDF提供的相同级别的自定义和灵活性。

跨平台兼容性

IronPDF。

IronPDF凭借其广泛的跨平台兼容性而脱颖而出。 它支持.NET框架内的多种环境,确保在不同平台之间的无缝操作。 以下是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

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 vs. DocRaptor的PDF功能

IronPDF。

  • PDF转换:IronPDF可以将HTML转换为PDF。 凭借对现代Web标准的全面支持,您可以放心地IronPDF将始终如一地从HTML内容返回像素完美的PDF文档。 IronPDF还可以将其他格式的文件转换为PDF,如DOCX、图像、RTF等。

  • PDF生成:使用IronPDF,您可以从URLs、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

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 does not natively support PDF encryption features.

IronPDF provides built-in encryption, metadata, and security controls, whereas DocRaptor would require third-party tools to achieve similar functionality.

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允许详细的定制在
a href="/how-to/stamp-text-image/">盖章文本和图像方面,使其成为文档注释和品牌的卓越选择。 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那样的外部库,因为它缺乏此任务的内建支持。

代码示例比较总结

IronPDF vs. DocRaptor

要了解IronPDF提供的丰富功能集,并看到它们的实际应用,请查看IronPDF的入门指南,深入探讨每个功能,探索它们的工作原理,并为您提供成为PDF专家所需的技能。

Bootstrap及现代CSS框架渲染支持

使用CSS框架如Bootstrap、Tailwind和Foundation构建的现代Web应用程序需要精准保留这些框架布局的PDF生成工具。 这种能力对于维护网页和PDF输出的一致性设计非常关键。

IronPDF。: Native Bootstrap and Framework Support

IronPDF使用Chromium引擎提供对所有现代CSS框架的全面支持:

  • Bootstrap 5:完全支持所有响应式实用程序的Flexbox和CSS Grid
  • Bootstrap 4:完整的卡片系统、导航和表单组件
  • Tailwind CSS:所有实用类和响应式修饰符
  • Foundation:完整的网格和组件系统
  • Modern CSS3:Flexbox,网格,自定义属性,动画,和变换
  • JavaScript支持:提供对框架交互的完全执行

Real-world validation: Bootstrap homepage and official templates convert with browser-accurate fidelity.

代码示例:带Bootstrap的FAQ手风琴

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'>
                            <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'>
                            <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'>
                            <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'>
                            <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'>
                            <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'>
                            <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'>
                            <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'>
                            <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");
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

输出: 一个使用Bootstrap的手风琴组件、警报框、卡片样式和响应式栅格的专业FAQ页面—均在PDF中准确渲染。

DocRaptor:良好的Bootstrap支持与API复杂度

DocRaptor是一个基于云的服务,使用Prince XML渲染引擎,支持良好的CSS:

  • Bootstrap 4/5支持:通常对Bootstrap布局有良好的支持
  • Prince XML引擎:专业级的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:此许可证支持一名开发者、一个地点和一个项目。 定价可申请而提供。

  • Plus License:支持三名开发者,三处地点,和三个项目,这是lite许可证的下一步,费用$1,199。 Plus许可证除了电子邮件支持外,还提供聊天支持和电话支持。

  • Professional License:此许可证适合更大的团队,支持十名开发者,十个地点和十个项目,费用$2,399。 该许可证提供与之前的层级相同的联系方式支持渠道,并额外支持屏幕共享。

  • 免版税再分配:IronPDF的许可还提供免版税再分配覆盖,额外$2,399

  • 不中断的产品支持:IronPDF提供持续的产品更新、$1,199/年安全功能升级和从工程团队的支持,或一次性购买的$2,399为五年保障一次性购买。

  • Iron Suite: For $1,498, you get access to all Iron Software products including IronPDF, IronOCR, IronWord, IronXL, IronBarcode, IronQR, IronZIP, IronPrint, and IronWebScraper.

IronPDF Pricing

DocRaptor

DocRaptor根据使用提供几种定价选项。 起始价格为$15每月,这是基于使用的,这意味着根据您生成的文档量而有所不同。 他们还提供免费试用,以便在承诺付费前测试服务。

文档和支持:IronPDF vs. DocRaptor

IronPDF。

IronPDF在提供详细使用文档和支持方面表现突出:

  • 综合文档:广泛而友好的用户文档,涵盖所有功能。
  • 24/5支持:提供活跃的工程师支持。
  • 视频教程:在YouTube上提供逐步的视频指南。
  • 社区论坛:提供额外支持的活跃社区。
  • 定期更新:每月的产品更新确保最新功能和安全性修补。
  • PDF API参考:提供API参考,以便您能充分利用我们的工具。

For more information, check out IronPDF's extensive documentation, and visit the Iron Software YouTube Channel.

DocRaptor

  • API参考:详细说明了如何将DocRaptor与多种编程语言集成,涵盖PDF和Excel生成。
  • 入门指南:为新用户提供的逐步教程,帮助他们设置和使用DocRaptor进行HTML到PDF转换。
  • 客户端库:提供流行语言的代码示例和库,包括Java、C#、Python、PHP、Ruby和Node.js。
  • 电子邮件支持:提供技术援助或与服务相关的技术问题询问。

结论

综上所述,IronPDF和DocRaptor均为HTML生成PDF提供了强大的解决方案,但它们针对不同受众和项目需求。 IronPDF在与.NET环境的无缝集成方面表现突出,提供多样化的选择范围和离线处理能力。 它非常适合在.NET框架下工作的开发者,他们需要对PDF生成和操作有精准控制。 另一方面,DocRaptor凭借其基于云的模型在多编程语言中提供兼容PDF/A标准和简单API,成为可靠的跨平台文档生成项目的绝佳选择。

最终,IronPDF和DocRaptor的选择应取决于您的开发栈、所需控制级别,以及您是否偏好云端或本地化的解决方案。

[{i:(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,添加新内容、修改文本、插入图像或应用注释。

可以使用 .NET PDF 库对 PDF 进行安全加固吗?

IronPDF 允许您通过加密和数字签名来保护 PDF,从而提供增强的文档安全性和真实性。

云端与离线 PDF 处理有什么区别?

像 DocRaptor 这样的基于云的 PDF 处理需要互联网连接,并通过云中的 API 执行任务。离线处理,如使用 IronPDF,允许您在无需依赖互联网的情况下,在本地环境中直接生成和操作 PDF。

DocRaptor 如何处理 Web 应用程序的 PDF 生成?

DocRaptor 使用基于云的 API 方法,要求开发者使用 API 密钥来在 Web 应用程序中将 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 对物联网 (IoT) 有浓厚的兴趣,探索将硬件和软件集成的新方法。在空闲时间,他喜欢玩游戏和构建 Discord 机器人,将他对技术的热爱与创造力相结合。