跳過到頁腳內容
產品比較

CraftMyPDF vs IronPDF:哪個PDF生成程式庫適合C#開發者?

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 檔案。 它提供了一個基於網頁的拖放式編輯器,無需編碼即可設計可重複使用的模板。 該平台透過將這些範本與 JSON 資料合併來產生 PDF,支援動態產生發票報告和證書等文件的內容。

CraftMyPDF 的主要特性是什麼?

1.拖放式編輯器:無需編碼知識的可視化模板設計器。

2.模板可重用性:一次設計,可重複用於不同的資料集。

  1. JSON 資料整合:透過 JSON 將動態資料與範本合併。

4.進階格式和表達式:動態設定日期、數字和貨幣的格式。

  1. API 整合: REST API 支援 Zapier、Make.com 和自訂應用程式。

6.可填寫元件:建立帶有文字欄位和複選框的互動式表單

7.安全性和合規性:透過區域 API 端點和 GDPR 合規性確保 PDF 存取安全性。

IronPDF是什麼?

IronPDF PDF Library for .NET Developers是一個完整的.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

  1. 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.解決方案名稱:通常與專案名稱一致

  1. 點選"建立"繼續

如何安裝IronPDF?

IronPDF提供三種安裝方法: NuGet套件管理器套件管理器控制台和直接下載。 該程式庫支援WindowsmacOSLinux雲端部署

如何使用NuGet套件管理器?

在 Visual Studio 中,以滑鼠右鍵按一下解決方案資源管理器中的"參考"或"依賴項"。 選擇"管理NuGet套件",搜尋"IronPDF",然後按一下"安裝"。

Visual Studio NuGet套件管理器顯示IronPDF搜尋結果,其中已安裝主IronPDF套件版本 2024.5.2,以及IronPDF和IronPDF等相關套件。

如何使用NuGet套件管理器控制台?

開啟"工具"> "NuGet套件管理員">"套件管理員控制台",然後執行:

Install-Package IronPdf

如何從NuGet網站下載?

造訪NuGet網站,下載套件文件,並將其作為套件來源新增至 Visual Studio 。 對於Docker 部署,請使用特定的容器配置。

有關詳細指導,請參閱安裝概述高級NuGet配置

如何使用 CraftMyPDF

若要整合 CraftMyPDF,請建立帳戶、選擇套餐並取得 API 憑證。

如何建立帳戶並選擇免費套餐?

1.註冊:CraftMyPDF 網站註冊 2.選擇免費方案:選擇免費方案進行開發與測試 3.取得 API 金鑰:從帳戶控制面板存取 API 金鑰。

CraftMyPDF 控制面板顯示免費方案訂閱詳情、已使用 6/50 個積分以及包含簽名域等新功能和錯誤修復的最新更新日誌

我需要安裝哪些函式庫?

安裝.NETRestSharpNewtonsoft.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# 中的 ChromePdfRenderer 將 HTML 轉換為 PDF 的 C# 程式碼範例,該NuGet下載量為 9,229,207 次,並列出了其主要功能。

了解更多關於URL轉PDF的資訊。 已驗證的頁面,請參閱TLS 網站登入HTTP 請求標頭

如何將HTML檔案轉換為PDF?

將本機 HTML 檔案轉換為 PDF,並支援CSS 媒體類型基本 URL

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.設定 RestClient使用 CraftMyPDF API 端點初始化客戶端 2.新增請求頭:包含用於身份驗證的 API 金鑰和內容類型 3.準備請求體:建立包含範本資料和選項的 JSON 對象 4.發送請求:執行 API 呼叫產生 PDF 5.處理回應:下載產生的 PDF 或顯示錯誤訊息

技術型創辦人的主要差異是什麼?

基於模板的方法和程式碼優先的方法有何不同?

基於範本(CraftMyPDF): 非技術團隊成員可以建立和修改模板 範本在雲端控制面板中集中管理。

  • 模板的更改不需要部署程式碼 受限於模板設計限制
  • 最適合佈局可預測的標準化文檔

Code-First(IronPDF):

  • 使用 HTML 和 CSS 完全控製文件佈局
  • JavaScript支援可實現動態圖表和計算 範本是程式碼庫的一部分,並納入了版本控制。
  • 與任何網路技術都能實現無限的設計彈性
  • 非常適合需要程式邏輯的複雜、動態文檔

對於Razor模板, IronPDF為MVC CoreMVC FrameworkRazor Pages提供原生支援。

不同規模下的成本影響是什麼?

CraftMyPDF 成本結構: 免費套餐:每月 50 次 API 調用,最多可使用 3 個範本。 付費套餐的月費起價較高。 每個PDF的成本與文件數量呈線性關係

  • 持續的月度/年度訂閱費用
  • 高級功能的額外費用

IronPDF成本結構: -免費試用,全面評估

  • 一次性永久許可,自 $799 起
  • 無單次PDF費用或使用限制
  • 包含一年的更新和支援服務
  • SaaS產品的OEM再分銷選項

對於每月處理 1000 個以上 PDF 文件的應用程序,IronPDF 的永久許可證提供可預測的成本,無需持續費用。 許可證費用計算器有助於估算總擁有成本。 考慮為不斷壯大的團隊進行升級擴展

開發工作流程有何不同?

CraftMyPDF 工作流程:

  1. 設計者在網頁介面建立模板
  2. 開發人員將 JSON 欄位對應到模板
  3. API 整合需要進行身份驗證設置
  4. 測試需要呼叫 API 並消耗積分。
  5. 模板更新發生在程式碼部署之外

IronPDF工作流程:

  1. 開發人員用程式碼編寫 HTML/CSS 模板。 2.本地測試不受 API 限制
  2. 範本隨應用程式程式碼一起部署
  3. 版本控制追蹤所有更改
  4. CI/CD 整合以實現自動化測試

IronPDF 的獨立式方法可以加快迭代週期並支援離線開發,這對快速開發至關重要。 該庫支援自訂日誌記錄渲染選項,方便調試。

資料隱私和合規性方面又該如何解決?

CraftMyPDF 資料處理:

  • 在雲端伺服器上處理的文檔
  • 需要透過網路進行資料傳輸
  • 區域合規性終點 暫存檔案儲存策略 第三方資料處理協議

IronPDF數據處理:

對於處理敏感客戶資料的應用程序,IronPDF 的本地處理消除了第三方隱私問題。 數位簽章密碼保護提供了額外的安全保障。 該庫也支援PDF/APDF/UA標準,以符合相關規範。

我多久可以新增的文件類型?

CraftMyPDF 時間軸:

  • 模板設計:1-4 小時,取決於複雜程度
  • 現場測繪與測試:1-2 小時
  • 取決於設計師的檔期 模板審批流程可能會增加延誤。 受限於編輯器功能

IronPDF時間軸:

  • HTML範本建立:30分鐘至2小時
  • 使用現有的 Web 框架,例如 Bootstrap
  • 在文件中重複使用 CSS 樣式表
  • 本地測試並獲得即時回饋
  • 透過定期發布部署新的文件類型

IronPDF 的程式碼優先方法通常可以縮短新文件類型的上市時間,尤其是在使用現有 Web 資源和框架時。 本程式庫支援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) 支援單一開發人員在一個專案中工作。 專業版授權($1,199)涵蓋多個專案和開發人員。 企業版授權($2,399)適用於部署需求廣泛的大型團隊。 每個許可證均包含一年的支援和更新服務。 OEM再分發許可允許商業分發。 提供免費試用版供您評估。 查看完整的授權選項

CraftMyPDF 採用訂閱式定價。 免費套餐適用於 API 呼叫次數有限的開發和測試。 付費方案可提高使用限額並增加功能,以滿足業務需求。 訂閱透過 CraftMyPDF 控制面板進行管理。

有哪些文件和支援服務?

IronPDF在文件和支持方面提供哪些服務?

IronPDF提供完整的文檔,包括詳細指南、範例快速入門部分。 資源涵蓋從基本用法到高級配置的各個方面。 支援管道包括知識庫、電子郵件支援和工程支援請求。 我們的支援團隊每週 5 天、每天 24 小時運轉,隨時為您提供協助。 故障排除指南針對常見問題進行講解。

文件包括所有功能的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 提供基于網頁的拖放编辑器,允許用戶在不需要编碼的情况下設计 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 熱衷於創建直觀且美觀的用戶界面,喜歡使用現代框架並打造結構良好、視覺吸引人的手冊。

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

Iron Support Team

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