跳至页脚内容
产品比较

CraftMyPDF vs IronPDF:C#开发者应该选择哪个PDF生成库?

IronPDF 提供代码优先的HTML到PDF转换,支持完整的CSS/JavaScript,自$749起的永久许可,而CraftMyPDF提供基于云的模板设计,结合JSON集成,但需要持续订阅和API依赖。

CraftMyPDF 提供基于云的拖放式模板设计器,与JSON数据集成,而IronPDF为.NET开发者提供代码优先的HTML到PDF转换,支持完整的CSS/JavaScript,让开发者能够完全控制文档生成。

PDF(或便携式文档格式)是一种由Adobe公司开发的用于文档交换的文件格式。 它在设备之间保留格式、字体和图像,确保一致的外观。 PDF支持安全功能、交互性和压缩,使其成为可靠文档共享的理想选择。

C# PDF库支持开发者以编程方式创建修改提取PDF内容。 这些工具支持表单处理数字签名跨平台部署。 通过集成PDF库,开发者可以直接在他们的应用程序中添加文档生成功能,简化创建、编辑管理PDF的工作流。

本文比较了两种不同的PDF生成方法:IronPDF C#库Craftmypdf API。 比较包括功能检查、代码示例和讨论许可选项

什么是CraftMyPDF API基础解决方案?

CraftMyPDF主页显示拖放式PDF编辑器界面,正在实时编辑装箱单模板

CraftMyPDF是一个基于云的API,通过模板创建PDF。 它提供了一个基于Web的拖放式编辑器,用于设计可重用模板而无需编码。 该平台通过将这些模板与JSON数据合并来生成PDF,支持生成动态内容的文档,如发票报告和证书。

CraftMyPDF 的关键功能是什么?

  1. 拖放式编辑器:需要无代码知识的可视化模板设计器。

  2. 模板可重用性:设计一次,用于不同的数据集。

  3. JSON数据集成:通过JSON将动态数据与模板合并。

  4. 高级格式和表达式:动态格式化日期、数字和货币。

  5. API集成:REST API支持Zapier、Make.com和自定义应用程序。

  6. 可填充组件:使用文本字段和复选框创建交互式表单

  7. 安全和合规:通过区域API端点和GDPR合规性确保PDF访问安全。

什么是 IronPDF?

面向.NET开发者的IronPDF PDF库是一个完整的.NET应用程序PDF库。 用C#编写,它从HTMLCSSJavaScript图像生成像素完美的PDF。 IronPDF通过提供广泛的功能来简化.NET环境中的PDF工作流,包括创建、编辑和管理。

IronPDF 的关键功能是什么?

  1. HTML 到 PDF 转换:将 HTML、CSS 和 JavaScript 转换为 PDF,具有像素完美的精确度

  2. URL 到 PDF:从任何URL生成PDF,保留内容和响应式样式

  3. 图像到 PDF:将JPG、PNG、GIF、BMP和SVG转换为PDF文档,支持多帧TIFF

  4. 表单填写和数据提取:以编程方式创建和填写PDF表单,具有自定义验证

  5. 数字签名和安全:添加数字签名密码权限,具有HSM支持

  6. PDF编辑:添加、复制或删除页面合并和拆分PDF,具有页面旋转功能。

  7. 注释和附件:添加便签嵌入式附件,具有自定义元数据支持。

  8. 页眉、页脚和水印:使用自定义页眉、页脚水印,在HTML模板中应用

  9. 跨平台兼容性:适用于WindowsmacOSLinuxDockerAzureAWS

  10. 性能优化:支持大批量生成的多线程和异步并行处理

  11. 完整文档:丰富的指南教程24/5技术支持

  12. 无外部依赖:单一 DLL 部署,无需额外软件,通过本地渲染引擎实现。

如何在Visual Studio中创建C#应用程序?

创建C#控制台应用程序需要已在计算机上安装Visual Studio。 按照以下步骤设置项目:

如何打开Visual Studio?

从开始菜单或桌面图标启动Visual Studio。

如何创建新项目?

  1. 在开始页面上点击 "创建新项目"
  2. 搜索"控制台应用程序"或从模板列表中选择。

如何选择项目模板?

根据需求选择"控制台应用(.NET Core)""控制台应用(.NET Framework)"。 对于.NET MAUI支持,选择适当的MAUI模板。

如何配置我的项目?

  1. 项目名称:输入项目名称
  2. 位置:选择保存目录
  3. 解决方案名称:通常与项目名称一致
  4. 点击"创建"以继续

如何安装 IronPDF?

IronPDF 提供三种安装方法:NuGet 包管理器包管理器控制台和直接下载。 该库支持WindowsmacOSLinux云部署

如何使用NuGet包管理器?

在Visual Studio中,右键点击解决方案资源管理器中的"引用"或"依赖项"。 选择"管理NuGet包",搜索"IronPDF",然后点击"安装"。

Visual Studio NuGet包管理器显示IronPDF搜索结果,其中主要IronPDF包版本2024.5.2已安装,并可见相关包如IronPdf.Native.Chrome.Windows和IronPdf.Slim

如何使用NuGet包管理控制台?

打开工具 > NuGet 包管理器 > 包管理器控制台并运行:

Install-Package IronPdf

如何从NuGet网站下载?

访问NuGet网站,下载包文件,并将其作为包源添加到Visual Studio中。 对于Docker部署,请使用特定的容器配置。

有关详细指南,请参见安装概览高级NuGet配置

我该如何使用CraftMyPDF

要集成CraftMyPDF,请创建账户、选择计划并获取API凭据。

如何创建账户并选择免费计划?

  1. 注册:CraftMyPDF网站注册
  2. 选择免费计划:选择用于开发和测试的免费层
  3. 获取API密钥:从账户仪表盘获取API密钥

CraftMyPDF仪表盘显示免费计划订阅详情,已使用6/50额度,以及包含全新功能如签名字段和修复Bug的近期更改日志

我需要安装哪些库?

安装System.Net.HttpRestSharpNewtonsoft.Json包:

using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using RestSharp;
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using RestSharp;
$vbLabelText   $csharpLabel

初始化API客户端:

var client = new RestClient("___PROTECTED_URL_51___");
var request = new RestRequest(Method.Post);
string apiKey = "API Key"; // Replace with your actual API key
string templateId = "Template ID"; // Replace with your actual template ID
request.AddHeader("X-API-KEY", apiKey);
request.AddHeader("Content-Type", "application/json");
var client = new RestClient("___PROTECTED_URL_51___");
var request = new RestRequest(Method.Post);
string apiKey = "API Key"; // Replace with your actual API key
string templateId = "Template ID"; // Replace with your actual template ID
request.AddHeader("X-API-KEY", apiKey);
request.AddHeader("Content-Type", "application/json");
$vbLabelText   $csharpLabel

如何创建PDF?

两个库提供不同的PDF生成方法。 IronPDF使用基于代码的HTML渲染,而CraftMyPDF使用带数据绑定的可视化模板。 IronPDF还支持Markdown到PDFXML到PDF的转换。

如何使用IronPDF创建PDF?

如何将HTML转换为PDF?

直接将HTML字符串转换为PDF,支持完整的CSSJavaScript渲染

using IronPdf;
public class PDFCreator
{
    public void CreatePdfFromHtml()
    {
        var renderer = new ChromePdfRenderer();
        // Define your HTML string
        string htmlContent = "<h1>Hello, IronPDF!</h1><p>This is a sample PDF document created from an HTML string.</p>";
        // Render the HTML as a PDF document
        var pdfDocument = renderer.RenderHtmlAsPdf(htmlContent);
        // Save the PDF document
        pdfDocument.SaveAs("html_output.pdf");
    }
}
using IronPdf;
public class PDFCreator
{
    public void CreatePdfFromHtml()
    {
        var renderer = new ChromePdfRenderer();
        // Define your HTML string
        string htmlContent = "<h1>Hello, IronPDF!</h1><p>This is a sample PDF document created from an HTML string.</p>";
        // Render the HTML as a PDF document
        var pdfDocument = renderer.RenderHtmlAsPdf(htmlContent);
        // Save the PDF document
        pdfDocument.SaveAs("html_output.pdf");
    }
}
$vbLabelText   $csharpLabel

IronPDF生成的PDF文档截图,展示

欲查看更多示例,请访问HTML到PDF示例页面。 开发者还可以设置自定义边距添加分页符,和配置纸张大小

如何将URL转换为PDF?

在保持所有样式的同时将网页转换为PDF,包括WebGL内容响应式CSS

using IronPdf;
public class PDFCreator
{
    public void CreatePdfFromUrl(string url)
    {
        // Initialize the ChromePdfRenderer
        var renderer = new ChromePdfRenderer();
        // Render the URL as a PDF document
        var pdfDocument = renderer.RenderUrlAsPdf(url);
        // Save the PDF document
        pdfDocument.SaveAs("url_output.pdf");
    }
}
using IronPdf;
public class PDFCreator
{
    public void CreatePdfFromUrl(string url)
    {
        // Initialize the ChromePdfRenderer
        var renderer = new ChromePdfRenderer();
        // Render the URL as a PDF document
        var pdfDocument = renderer.RenderUrlAsPdf(url);
        // Save the PDF document
        pdfDocument.SaveAs("url_output.pdf");
    }
}
$vbLabelText   $csharpLabel

IronPDF主页展示C#代码示例,使用C#中的ChromePdfRenderer进行HTML到PDF转换,NuGet下载次数为9,229,207次以及库的关键功能

了解更多关于URL到PDF转换的信息。 有关需身份验证的页面,请参见TLS网站登录HTTP请求头

如何将HTML文件转换为PDF?

在支持CSS媒体类型基础URL的情况下将本地HTML文件转换为PDF:

using IronPdf;
public class PDFCreator
{
    public void CreatePdfFromHtmlFile(string filePath)
    {
        // Initialize the ChromePdfRenderer
        var renderer = new ChromePdfRenderer();
        // Render the HTML file as a PDF document
        var pdfDocument = renderer.RenderHtmlFileAsPdf(filePath);
        // Save the PDF document
        pdfDocument.SaveAs("html_file_output.pdf");
    }
}
using IronPdf;
public class PDFCreator
{
    public void CreatePdfFromHtmlFile(string filePath)
    {
        // Initialize the ChromePdfRenderer
        var renderer = new ChromePdfRenderer();
        // Render the HTML file as a PDF document
        var pdfDocument = renderer.RenderHtmlFileAsPdf(filePath);
        // Save the PDF document
        pdfDocument.SaveAs("html_file_output.pdf");
    }
}
$vbLabelText   $csharpLabel

查看HTML文件到PDF指南了解详情。 对于HTML ZIP文件,IronPDF会自动处理提取。

如何使用CraftMyPDF API创建PDF?

CraftMyPDF 需要首先创建模板,然后通过合并数据生成PDF。

如何创建模板?

  1. 登录仪表盘:访问CraftMyPDF账户
  2. 创建新模板:使用拖放式编辑器进行设计
  3. 保存模板:获取用于API调用的模板ID

CraftMyPDF模板管理仪表盘,展示发票模板和编辑工具以及教程资源

如何发送请求生成PDF?

通过向模板发送JSON数据来生成PDF:

using System;
using System.Net;
using System.Threading.Tasks;
using RestSharp;

class Program
{
    static async Task Main(string[] args)
    {
        var client = new RestClient("___PROTECTED_URL_52___");
        var request = new RestRequest(Method.Post);
        string apiKey = "API-Key"; // Replace with your actual API key
        string templateId = "Template-ID"; // Replace with your actual template ID
        request.AddHeader("X-API-KEY", apiKey);
        request.AddHeader("Content-Type", "application/json");
        var body = new
        {
            data = new
            {
                invoice_number = "INV48321",
                date = "2024-05-27",
                due_date = "2024-06-27",
                currency = "EUR",
                discount = 10,
                tax = 5,
                company_name = "Tech Innovations Ltd",
                email = "contact@techinnovations.com",
                client = "Future Solutions GmbH",
                client_address = "1234 Innovation Drive",
                client_address2 = "Berlin",
                client_address3 = "10115",
                items = new[]
                {
                    new { description = "Cloud Hosting Services", quantity = 12, unit_price = 75, total = 900 },
                    new { description = "Custom Web Application", quantity = 3, unit_price = 150, total = 450 },
                    new { description = "Technical Support", quantity = 15, unit_price = 30, total = 450 },
                    new { description = "Digital Marketing Campaign", quantity = 2, unit_price = 500, total = 1000 },
                    new { description = "SEO Optimization", quantity = 5, unit_price = 120, total = 600 }
                },
                gross_total = 3400
            },
            load_data_from = (string)null,
            template_id = templateId,
            version = 8,
            export_type = "json",
            expiration = 60,
            output_file = "output.pdf",
            is_cmyk = false,
            image_resample_res = 600,
            direct_download = 0,
            cloud_storage = 1
        };
        request.AddJsonBody(body);
        RestResponse response = await client.ExecuteAsync(request);
        Console.WriteLine(response.Content);
        if (response.IsSuccessful)
        {
            var content = response.Content;
            dynamic result = Newtonsoft.Json.JsonConvert.DeserializeObject(content);
            string fileUrl = result.file;
            string localPath = "f:\\downloaded_output.pdf";
            using (WebClient webClient = new WebClient())
            {
                webClient.DownloadFile(fileUrl, localPath);
            }
            Console.WriteLine($"PDF downloaded successfully to {localPath}");
        }
        else
        {
            Console.WriteLine($"Error: {response.Content}");
        }
    }
}
using System;
using System.Net;
using System.Threading.Tasks;
using RestSharp;

class Program
{
    static async Task Main(string[] args)
    {
        var client = new RestClient("___PROTECTED_URL_52___");
        var request = new RestRequest(Method.Post);
        string apiKey = "API-Key"; // Replace with your actual API key
        string templateId = "Template-ID"; // Replace with your actual template ID
        request.AddHeader("X-API-KEY", apiKey);
        request.AddHeader("Content-Type", "application/json");
        var body = new
        {
            data = new
            {
                invoice_number = "INV48321",
                date = "2024-05-27",
                due_date = "2024-06-27",
                currency = "EUR",
                discount = 10,
                tax = 5,
                company_name = "Tech Innovations Ltd",
                email = "contact@techinnovations.com",
                client = "Future Solutions GmbH",
                client_address = "1234 Innovation Drive",
                client_address2 = "Berlin",
                client_address3 = "10115",
                items = new[]
                {
                    new { description = "Cloud Hosting Services", quantity = 12, unit_price = 75, total = 900 },
                    new { description = "Custom Web Application", quantity = 3, unit_price = 150, total = 450 },
                    new { description = "Technical Support", quantity = 15, unit_price = 30, total = 450 },
                    new { description = "Digital Marketing Campaign", quantity = 2, unit_price = 500, total = 1000 },
                    new { description = "SEO Optimization", quantity = 5, unit_price = 120, total = 600 }
                },
                gross_total = 3400
            },
            load_data_from = (string)null,
            template_id = templateId,
            version = 8,
            export_type = "json",
            expiration = 60,
            output_file = "output.pdf",
            is_cmyk = false,
            image_resample_res = 600,
            direct_download = 0,
            cloud_storage = 1
        };
        request.AddJsonBody(body);
        RestResponse response = await client.ExecuteAsync(request);
        Console.WriteLine(response.Content);
        if (response.IsSuccessful)
        {
            var content = response.Content;
            dynamic result = Newtonsoft.Json.JsonConvert.DeserializeObject(content);
            string fileUrl = result.file;
            string localPath = "f:\\downloaded_output.pdf";
            using (WebClient webClient = new WebClient())
            {
                webClient.DownloadFile(fileUrl, localPath);
            }
            Console.WriteLine($"PDF downloaded successfully to {localPath}");
        }
        else
        {
            Console.WriteLine($"Error: {response.Content}");
        }
    }
}
$vbLabelText   $csharpLabel

Visual Studio调试控制台显示从CraftMyPDF API成功生成PDF的输出及JSON响应详情

生成的PDF输出:

来自Tech Innovations Ltd的发票,展示包括SEO、数字营销、技术支持、Web应用程序、云托管等各种技术服务,折扣和税后的总额为€2,907.00

如何使用Bootstrap生成专业发票?

IronPDF可以无外部依赖地渲染现代框架。 本Bootstrap 5示例演示了通过响应式设计打印CSS生成专业发票:

using IronPdf;

var renderer = new ChromePdfRenderer();

string professionalInvoice = @"
<!DOCTYPE html>
<html>
<head>
    <meta charset='utf-8'>
    <link href='___PROTECTED_URL_53___ rel='stylesheet'>
    <style>
        .invoice-header { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; }
        .invoice-table th { background: #f8f9fa; }
        @media print { .invoice-box { page-break-inside: avoid; } }
    </style>
</head>
<body>
    <div class='container my-4'>
        <div class='card shadow-lg invoice-box'>
            <div class='invoice-header p-4'>
                <div class='row align-items-center'>
                    <div class='col-md-8'>
                        <h1 class='mb-0'>INVOICE</h1>
                        <p class='mb-0 opacity-75'>Invoice #INV-2024-0427</p>
                    </div>
                    <div class='col-md-4 text-md-end'>
                        <h3 class='mb-0'>$3,400.00</h3>
                        <small class='opacity-75'>Due: June 27, 2024</small>
                    </div>
                </div>
            </div>

            <div class='card-body p-4'>
                <div class='row mb-4'>
                    <div class='col-md-6'>
                        <h6 class='text-primary text-uppercase mb-2'>From</h6>
                        <strong>Tech Innovations Ltd</strong><br>
                        contact@techinnovations.com
                    </div>
                    <div class='col-md-6 text-md-end'>
                        <h6 class='text-primary text-uppercase mb-2'>Bill To</h6>
                        <strong>Future Solutions GmbH</strong><br>
                        1234 Innovation Drive<br>
                        Berlin, 10115
                    </div>
                </div>

                <table class='table invoice-table'>
                    <thead>
                        <tr>
                            <th>Description</th>
                            <th class='text-center'>Qty</th>
                            <th class='text-end'>Unit Price</th>
                            <th class='text-end'>Total</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td>Cloud Hosting Services</td>
                            <td class='text-center'>12</td>
                            <td class='text-end'>€75.00</td>
                            <td class='text-end'>€900.00</td>
                        </tr>
                        <tr>
                            <td>Custom Web Application</td>
                            <td class='text-center'>3</td>
                            <td class='text-end'>€150.00</td>
                            <td class='text-end'>€450.00</td>
                        </tr>
                        <tr>
                            <td>Technical Support</td>
                            <td class='text-center'>15</td>
                            <td class='text-end'>€30.00</td>
                            <td class='text-end'>€450.00</td>
                        </tr>
                        <tr>
                            <td>Digital Marketing Campaign</td>
                            <td class='text-center'>2</td>
                            <td class='text-end'>€500.00</td>
                            <td class='text-end'>€1,000.00</td>
                        </tr>
                        <tr>
                            <td>SEO Optimization</td>
                            <td class='text-center'>5</td>
                            <td class='text-end'>€120.00</td>
                            <td class='text-end'>€600.00</td>
                        </tr>
                    </tbody>
                </table>

                <div class='row justify-content-end'>
                    <div class='col-md-4'>
                        <table class='table table-sm'>
                            <tr>
                                <td>Subtotal:</td>
                                <td class='text-end'><strong>€3,400.00</strong></td>
                            </tr>
                            <tr>
                                <td>Discount (10%):</td>
                                <td class='text-end text-success'>-€340.00</td>
                            </tr>
                            <tr>
                                <td>Tax (5%):</td>
                                <td class='text-end'>€153.00</td>
                            </tr>
                            <tr class='table-primary'>
                                <td><strong>Total Due:</strong></td>
                                <td class='text-end'><strong>€3,213.00</strong></td>
                            </tr>
                        </table>
                    </div>
                </div>

                <div class='alert alert-info mt-4'>
                    <strong>Payment Terms:</strong> Payment due within 30 days. Late payments may incur additional charges.
                </div>

                <div class='row mt-4 pt-3 border-top'>
                    <div class='col-md-6'>
                        <small class='text-muted'>Generated with IronPDF - No external APIs required</small>
                    </div>
                    <div class='col-md-6 text-md-end'>
                        <span class='badge bg-success'>PAID</span>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>";

var pdf = renderer.RenderHtmlAsPdf(professionalInvoice);
pdf.SaveAs("professional-invoice.pdf");
using IronPdf;

var renderer = new ChromePdfRenderer();

string professionalInvoice = @"
<!DOCTYPE html>
<html>
<head>
    <meta charset='utf-8'>
    <link href='___PROTECTED_URL_53___ rel='stylesheet'>
    <style>
        .invoice-header { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; }
        .invoice-table th { background: #f8f9fa; }
        @media print { .invoice-box { page-break-inside: avoid; } }
    </style>
</head>
<body>
    <div class='container my-4'>
        <div class='card shadow-lg invoice-box'>
            <div class='invoice-header p-4'>
                <div class='row align-items-center'>
                    <div class='col-md-8'>
                        <h1 class='mb-0'>INVOICE</h1>
                        <p class='mb-0 opacity-75'>Invoice #INV-2024-0427</p>
                    </div>
                    <div class='col-md-4 text-md-end'>
                        <h3 class='mb-0'>$3,400.00</h3>
                        <small class='opacity-75'>Due: June 27, 2024</small>
                    </div>
                </div>
            </div>

            <div class='card-body p-4'>
                <div class='row mb-4'>
                    <div class='col-md-6'>
                        <h6 class='text-primary text-uppercase mb-2'>From</h6>
                        <strong>Tech Innovations Ltd</strong><br>
                        contact@techinnovations.com
                    </div>
                    <div class='col-md-6 text-md-end'>
                        <h6 class='text-primary text-uppercase mb-2'>Bill To</h6>
                        <strong>Future Solutions GmbH</strong><br>
                        1234 Innovation Drive<br>
                        Berlin, 10115
                    </div>
                </div>

                <table class='table invoice-table'>
                    <thead>
                        <tr>
                            <th>Description</th>
                            <th class='text-center'>Qty</th>
                            <th class='text-end'>Unit Price</th>
                            <th class='text-end'>Total</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td>Cloud Hosting Services</td>
                            <td class='text-center'>12</td>
                            <td class='text-end'>€75.00</td>
                            <td class='text-end'>€900.00</td>
                        </tr>
                        <tr>
                            <td>Custom Web Application</td>
                            <td class='text-center'>3</td>
                            <td class='text-end'>€150.00</td>
                            <td class='text-end'>€450.00</td>
                        </tr>
                        <tr>
                            <td>Technical Support</td>
                            <td class='text-center'>15</td>
                            <td class='text-end'>€30.00</td>
                            <td class='text-end'>€450.00</td>
                        </tr>
                        <tr>
                            <td>Digital Marketing Campaign</td>
                            <td class='text-center'>2</td>
                            <td class='text-end'>€500.00</td>
                            <td class='text-end'>€1,000.00</td>
                        </tr>
                        <tr>
                            <td>SEO Optimization</td>
                            <td class='text-center'>5</td>
                            <td class='text-end'>€120.00</td>
                            <td class='text-end'>€600.00</td>
                        </tr>
                    </tbody>
                </table>

                <div class='row justify-content-end'>
                    <div class='col-md-4'>
                        <table class='table table-sm'>
                            <tr>
                                <td>Subtotal:</td>
                                <td class='text-end'><strong>€3,400.00</strong></td>
                            </tr>
                            <tr>
                                <td>Discount (10%):</td>
                                <td class='text-end text-success'>-€340.00</td>
                            </tr>
                            <tr>
                                <td>Tax (5%):</td>
                                <td class='text-end'>€153.00</td>
                            </tr>
                            <tr class='table-primary'>
                                <td><strong>Total Due:</strong></td>
                                <td class='text-end'><strong>€3,213.00</strong></td>
                            </tr>
                        </table>
                    </div>
                </div>

                <div class='alert alert-info mt-4'>
                    <strong>Payment Terms:</strong> Payment due within 30 days. Late payments may incur additional charges.
                </div>

                <div class='row mt-4 pt-3 border-top'>
                    <div class='col-md-6'>
                        <small class='text-muted'>Generated with IronPDF - No external APIs required</small>
                    </div>
                    <div class='col-md-6 text-md-end'>
                        <span class='badge bg-success'>PAID</span>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>";

var pdf = renderer.RenderHtmlAsPdf(professionalInvoice);
pdf.SaveAs("professional-invoice.pdf");
$vbLabelText   $csharpLabel

输出:带有Bootstrap 5渐变页眉、响应式表格及计算汇总的专业发票PDF。 IronPDF准确呈现所有CSS渐变、表格样式和实用程序类——无需外部API调用,无需模板,无需互联网连接。 与CraftMyPDF的云端方式不同,IronPDF在您的服务器上即时生成发票,并拥有完全控制。

代码的功能是什么?

  1. 设置CraftMyPDF API端点初始化客户端
  2. 添加报头:包括API密钥和内容类型以进行身份验证
  3. 准备请求主体:创建包含模板数据和选项的JSON对象
  4. 发送请求:执行API调用以生成PDF
  5. 处理响应:下载生成的PDF或显示错误消息

对技术创始人的主要区别是什么?

模板驱动和代码优先的方法如何比较?

模板驱动(CraftMyPDF):

  • 非技术团队成员可以创建和修改模板
  • 模板集中在云仪表盘中进行管理
  • 模板的更改不需要代码部署
  • 受模板设计限制的限制
  • 最适合具有可预测布局的标准化文档

代码优先(IronPDF):

  • 使用HTML和CSS完全控制文档布局
  • JavaScript支持支持动态图表和计算
  • 模板是代码库的一部分,具有版本控制
  • 无限设计灵活性,支持所有网络技术
  • 适合需要编程逻辑的复杂动态文档

对于Razor模板,IronPDF提供了对MVC CoreMVC FrameworkRazor Pages的本地支持。

不同规模的成本考虑是什么?

CraftMyPDF成本结构:

  • 免费层:每月50次API调用及3个模板限制
  • 付费计划始于较高月费
  • 随着量的增加逐线性递增每份PDF成本
  • 持续的每月/年度订阅费用
  • 高级功能的额外费用

IronPDF成本结构:

  • 免费试用以进行完整评估
  • 一次性永久许可证始于$799
  • 无每份PDF成本或使用限制
  • 包括一年更新和支持
  • 提供OEM再分发选项用于SaaS产品

对于每月处理1,000+ PDF的应用程序,IronPDF的永久许可证提供了可预测的成本,且没有持续费用。 许可计算器有助于估算总拥有成本。 考虑为成长型团队的升级扩展

开发工作流程有何不同?

CraftMyPDF工作流程:

  1. 设计人员在网络接口中创建模板
  2. 开发人员将JSON字段映射到模板
  3. API集成需要设置认证
  4. 测试需要API调用和额度使用
  5. 模板更新发生在代码部署之外

IronPDF工作流程:

  1. 开发人员在代码中编写HTML/CSS模板
  2. 无API限制的本地测试
  3. 与应用程序代码一起部署模板
  4. 版本控制记录所有更改
  5. 支持CI/CD集成进行自动测试

IronPDF的自包含方法支持快速迭代周期和离线开发,这对快速开发至关重要。 该库支持自定义日志渲染选项以进行调试。

关于数据隐私和合规性呢?

CraftMyPDF 数据处理:

  • 文档在云服务器上处理
  • 需要通过互联网进行数据传输
  • 区域端点以实现合规
  • 临时文件存储政策
  • 第三方数据处理协议

IronPDF数据处理:

  • 本地处理保持数据本地化
  • 无外部API调用或互联网要求
  • 完全控制文档安全
  • 支持HIPAA和GDPR合规的部署
  • 为敏感数据提供加密选项

对于处理敏感客户数据的应用程序,IronPDF的本地处理消除了第三方隐私问题。 数字签名密码保护提供了额外的安全层。 该库还支持<该库还支持PDF/APDF/UA标准以实现合规。

我能多快添加新文档类型?

CraftMyPDF 时间表:

  • 模板设计:根据复杂性需1-4小时
  • 字段映射和测试:需1-2小时
  • 取决于设计师的可用性
  • 模板审批流程可能会导致延误
  • 受编辑器功能限制

IronPDF时间表:

  • HTML模板创建:需30分钟到2小时
  • 使用现有的网络框架如Bootstrap
  • 跨文档重用CSS样式表
  • 本地测试即刻反馈
  • 定期发布新文档类型

IronPDF的代码优先方法通常会减少新文档类型的上市时间,尤其是使用现有的网络资源和框架时。 该库支持RTF到PDFDOCX到PDFMarkdown到PDF的转换以获得额外灵活性。

有哪些许可选项?

IronPDF pricing page showing three perpetual license tiers: Lite ($749), Plus ($1,499), and Professional ($2,999), with feature comparisons and an optional royalty-free redistribution add-on for $1,499

IronPDF 提供一次性费用的永久许可证。 Lite许可证($799)支持单个开发者在一个项目中的使用。 Professional许可证($1,199)覆盖多个项目和开发者。 Enterprise许可证($2,399)满足大型团队的广泛部署需求。 每个许可证包括一年的支持和更新。 一个OEM再分发许可证允许商业分发。 有一个免费的试用版可供评估。 查看完整的许可选项

CraftMyPDF使用基于订阅的定价。 免费层适合有限的API调用的开发和测试。 付费计划增加使用限制和增加的功能,根据业务需求进行扩展。 通过CraftMyPDF仪表板来管理订阅。

可用的文档和支持是什么?

IronPDF提供哪些文档和支持?

IronPDF提供完整文档,包括详细指南、示例快速启动部分。 资源涵盖基本用法到高级配置。 支持渠道包括知识库、电子邮件支持和工程支持请求。 支持团队以24/5方式运作,以提供即时帮助。 故障排除指南解决常见问题。

该文档包括API参考教程代码示例更新日志追踪更新,里程碑展示主要版本。 有关迁移支持,请参阅与AsposeiTextSyncfusion以及其他竞争对手比较的指南。

CraftMyPdf 提供哪些文档和支持?

CraftMyPDF 提供详细的API文档,包括端点、参数和示例。 指南涵盖模板创建、API请求和响应处理。 支持通过电子邮件和社区论坛提供,适用于问题和见解。

我应该选择哪个PDF解决方案?

IronPDF和CraftMyPDF都提供了有能力的PDF生成解决方案,有着截然不同的方法。 CraftMyPDF以其视觉模板设计器和基于云的处理而闻名,而IronPDF通过HTML渲染提供完整的编程控制。

IronPDF凭借其广泛的功能集在复杂的文档需求中脱颖而出。 它支持将HTMLURL文件转换为PDF,同时支持高级功能如数字签名表单处理文档编辑。 不依赖外部依赖的自包含部署确保了跨平台的可靠运行。

许可模式差异显著。 IronPDF的永久许可证起始于$799,提供一个免费的试用版用于评估。 Iron Suite捆绑包提供九款产品的价格仅为两款,提供了极具性价比的完整文档管理需求。

对于需要完全控制PDF生成的开发者,结合丰富的HTML/CSS支持和高级文档处理,以及可预测的成本,IronPDF提供了一个可靠的解决方案。 其丰富的文档响应式支持及灵活的部署选项,使之适用于从简单文档生成到复杂企业工作流的应用。

请注意CraftMyPDF 是其各自所有者的注册商标。 此网站与CraftMyPDF没有关联、认可或赞助关系。 所有产品名称、徽标和品牌均为各自所有者的财产。 比较仅供参考,反映撰写时公开可用的信息。)}]

常见问题解答

使用C# PDF库相比基于API的解决方案有什么优势?

像IronPDF这样全面的PDF库提供广泛的功能,与.NET开发环境无缝集成,强大的支持以及具有成本效益的许可选项,使其成为复杂文档处理的优良选择。

如何使用C#将HTML内容转换为PDF文档?

您可以使用IronPDF将HTML内容转换为PDF文档。它支持HTML5和CSS3,确保网页内容在生成的PDF中被准确呈现。

在IronPDF中用于PDF生成的关键功能是什么?

IronPDF提供数字签名、表单填写、PDF编辑、注释以及跨平台兼容性。它在将HTML、URL和图像转换为PDF方面表现出色,并具有强大的性能和优化。

CraftMyPDF如何处理PDF模板设计?

CraftMyPDF提供一个基于Web的拖放编辑器,允许用户无需编程即可设计PDF模板。它支持JSON数据集成,能够创建定制的PDF文档。

像IronPDF之类的PDF工具有哪些许可选项可用?

IronPDF提供灵活的许可选项,包括一次性费用的Lite、Professional和Enterprise许可证。它还为新用户提供免费试用,以探索其功能。

如何将PDF生成API集成到我的C#应用中?

要集成像CraftMyPDF这样的PDF生成API,您需要创建一个帐户,选择合适的计划,获取API密钥,并使用诸如System.Net.Http和RestSharp等库进行API调用。

为使用IronPDF的开发人员提供了哪些支持资源?

IronPDF提供广泛的文档、教程和24/5技术支持。这些资源帮助开发人员在项目中有效实现和排除库故障。

如何在C#应用程序中安装IronPDF?

可以通过Visual Studio中的NuGet包管理器安装IronPDF,使用NuGet包管理器控制台,或者直接从NuGet网站下载包。

IronPDF如何增强PDF文档的安全性和交互性?

IronPDF支持数字签名和表单处理等功能,增强了文档的安全性和交互性,使其适合于综合的PDF管理。

Curtis Chau
技术作家

Curtis Chau 拥有卡尔顿大学的计算机科学学士学位,专注于前端开发,精通 Node.js、TypeScript、JavaScript 和 React。他热衷于打造直观且美观的用户界面,喜欢使用现代框架并创建结构良好、视觉吸引力强的手册。

除了开发之外,Curtis 对物联网 (IoT) 有浓厚的兴趣,探索将硬件和软件集成的新方法。在空闲时间,他喜欢玩游戏和构建 Discord 机器人,将他对技术的热爱与创造力相结合。

Iron Support Team

We're online 24 hours, 5 days a week.
Chat
Email
Call Me