跳至頁尾內容
產品對比

C# PDF 函式庫的 APITemplate io 和 IronPDF 比較

身為 C# 開發人員,我在專案中產生和處理PDF 文件時經常遇到挑戰。 高效、可靠且易於整合的 PDF 解決方案是我們這個領域普遍存在的問題。 因此,我決定探索APITemplateIronPDF這兩個流行的工具,它們承諾簡化 C# 應用程式中與 PDF 相關的任務。

在本文中,我將分享我使用 APITemplate 和 IronPDF 的實際經驗,比較它們的功能、效能和整合能力。 我的目標是為您提供清晰、公正的分析,幫助您為下一個專案做出明智的決定。 當我第一次接觸 APITemplate 和 IronPDF 時,它們在解決 C# 開發中與 PDF 相關的挑戰方面的潛力就深深吸引了我。 讓我們來看看這些工具各自提供的功能。

API模板

C# PDF 函式庫的 APITemplate io 和 IronPDF 比較:圖 1

APITemplate 是一項基於雲端的服務,專注於根據模板產生 PDF 和圖像。 它提供了一個 API,允許開發人員透過將 JSON 資料傳送到預先定義的範本來建立文件和圖形。 在我的初步測試中,我發現 APITemplate 非常容易使用。 我可以使用他們的網頁介面建立一個模板,然後使用他們的 API 將我的 C# 應用程式中的資料填入該模板中。

API模板 的主要特性

基於模板的生成

APITemplate 的核心優勢在於其基於模板的方法。 我可以建立可重複使用的文件和圖像模板,這為我節省了大量重複性工作的時間。 它還提供了一個用於生成 PDF 的 Markdown 模板編輯器。 您可以使用與 Zapier 和其他第三方整合的可重複使用範本來產生 PDF 檔案。

JSON 資料集成

JSON 資料整合是我常用的功能之一。 它允許您使用 JSON 資料填充模板。 這使得它與我的 C# 應用程式整合變得非常容易,因為我可以將我的物件序列化為 JSON 並將其發送到 API。

API 控制台

API 控制台功能為我節省了很多時間。 有了它,我可以直接從他們的網站預覽和測試 API 調用,幫助我在 C# 程式碼中實現請求之前調試和微調請求。

可自訂的頁首和頁尾

能夠為 PDF 文件添加自訂頁首和頁尾的功能非常實用,尤其是在建立專業報告或發票時。 我可以輕鬆地添加頁碼、日期或公司標誌。

IronPDF

C# PDF 函式庫的 APITemplate io 和 IronPDF 比較:圖 2

另一方面, IronPDF是一個專門為在 C# 應用程式中操作 PDF 而設計的 .NET 程式庫。 它提供多種功能,包括 PDF 建立、編輯和轉換。 它的突出特點之一是能夠從 HTML 生成 PDF,這對於基於 Web 的應用程式來說非常有用。

我第一次接觸 IronPDF 是透過 NuGet 安裝並將其直接整合到我的 C# 專案中。 它的 API 整合過程非常流暢,這意味著我很快就能在我的專案中使用它。讓我印象深刻的是,我可以如此輕鬆地透過程式設計方式建立 PDF 文件,而無需依賴外部服務。

我注意到的主要區別在於,APITemplate 擅長使用預先定義的範本建立文檔,而 IronPDF 則提供了更大的靈活性,可以在 C# 程式碼中自訂 PDF 操作。 APITemplate 是基於雲端,這意味著您無需擔心 PDF 產生所需的伺服器資源,但它確實需要網路連線。 IronPDF 是一個本機庫,可以離線使用,但會佔用伺服器資源。

IronPDF 的主要特點

從 HTML 建立 PDF

IronPDF 擅長從 HTML 內容產生 PDF 檔案。 我曾廣泛使用此功能來動態建立報表和文件。 只需將 HTML 字串甚至 URL 傳遞給庫即可。 IronPDF 對現代 Web 標準的廣泛支援意味著我從 HTML 內容產生的每個 PDF 都是高品質的文件。

PDF 處理

此功能允許我以程式設計方式編輯現有的 PDF 檔案。 我可以在 PDF 文件中新增文字、圖像,甚至新頁面,這對於更新報告或表單非常有用。

PDF合併與拆分

我發現這個功能在處理大型文件時特別方便。 IronPDF 可以輕鬆地將多個 PDF 文件合併為一個文件,或將單一 PDF 文件分割為多個文件。

文字擷取

當我需要從 PDF 中提取文字內容進行分析或索引時,IronPDF 的文字擷取功能就派上了用場。 它能很好地處理各種 PDF 格式,使資料提取變得輕而易舉。

表格填寫

對於涉及自動填寫表單的項目,IronPDF 的表單填寫功能非常有用。 我可以透過程式設計方式自動填入 PDF 表單,從而節省手動資料輸入的時間。

數位簽名

在我的許多專案中,安全性都至關重要。 IronPDF 讓我可以為 PDF 檔案添加數位簽名,從而增強文件的真實性和安全性。

密碼保護

處理敏感文件時,我使用 IronPDF 為 PDF 新增密碼保護。 這對於確保我的機密資訊安全非常有幫助。

PDF 轉影像

有時我需要將PDF 頁面轉換為圖像以進行預覽或產生縮圖。 IronPDF 讓這個過程變得簡單,我只需要編寫幾行程式碼,而且它支援各種圖像格式。

跨平台相容性

作為一名從事跨平台專案的 .NET 開發人員,我非常欣賞 IronPDF 能夠跨不同作業系統無縫運行,這得益於它對 .NET Standard 的支援。

為您的 C# 專案配置 IronPDF 和 APITemplate

在 C# 專案中設定這些工具非常簡單。 我將根據我的經驗,帶你了解 IronPDF 和 APITemplate 的使用流程。

IronPDF

要在我的 C# 專案中設定 IronPDF,我按照以下步驟操作:

1.在 Visual Studio 中開啟我的專案。

2.使用 NuGet 套件管理器安裝 IronPDF。 我通常使用 NuGet 套件管理器或套件管理器控制台。

  1. 在 NuGet 套件管理器中搜尋 IronPDF 並安裝它。

    C# PDF 函式庫的 APITemplate io 和 IronPDF 比較:圖 3

  2. 或者,在軟體包管理器控制台中執行:

    Install-Package IronPdf

    C# PDF 函式庫的 APITemplate io 和 IronPDF 比較:圖 4

3.安裝完成後,我在 C# 檔案的頂部加入了必要的 using 語句:

   using IronPdf;
   using IronPdf;
$vbLabelText   $csharpLabel

4.為了啟動許可證,我在應用程式啟動時首先添加了以下程式碼行:

   IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY-HERE";
   IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY-HERE";
$vbLabelText   $csharpLabel

就是這樣! 現在我可以在我的程式碼中使用 IronPDF 了。

API模板

由於 APITemplate 是基於 Web 的 API,因此其設定過程略有不同:

1.首先,我在他們的網站上註冊了一個 APITemplate 帳戶。 2.註冊後,我進入 API 部分以取得我的 API 金鑰。 3.在我的 C# 專案中,我不需要安裝任何特定的套件。 我通常使用內建的 HttpClient 來進行 API 呼叫。

4.我會安全地儲存 API 金鑰。 在開發過程中,我可能會用到使用者金鑰:

   dotnet user-secrets set "APITemplate:ApiKey" "YOUR-API-KEY-HERE"
   dotnet user-secrets set "APITemplate:ApiKey" "YOUR-API-KEY-HERE"
SHELL

5.在我的程式碼中,我使用 API 金鑰設定了 HttpClient:

   using System.Net.Http;
   using System.Net.Http.Headers;

   var client = new HttpClient();
   client.DefaultRequestHeaders.Add("X-API-KEY", Configuration["APITemplate:ApiKey"]);
   using System.Net.Http;
   using System.Net.Http.Headers;

   var client = new HttpClient();
   client.DefaultRequestHeaders.Add("X-API-KEY", Configuration["APITemplate:ApiKey"]);
$vbLabelText   $csharpLabel

6.現在我準備向 APITemplate 發出 API 呼叫。

在這個專案中,我將使用APITemplate 的官方 GitHub 範例項目,該專案已經配置好,您只需要添加模板鍵。 完成這些設定後,我就可以在我的 C# 專案中使用 IronPDF 和 APITemplate 了。 IronPDF 在我的應用程式內部本地運行,而 APITemplate 需要網路連線才能與其伺服器通訊。

IronPDF 與 APITemplate 的進階功能

作為一名 C# 開發人員,我有機會探索了 IronPDF 和 APITemplate。 讓我們來看看他們的一些高級功能,這些功能給我留下了深刻的印象。

IronPDF 進階功能

支援 JavaScript 的 HTML 轉 PDF 轉換

IronPDF 的HTML 轉 PDF功能令人印象深刻。它不僅能渲染靜態 HTML,還能處理 JavaScript。 這在處理動態網頁內容時對我來說是一個很大的優勢。

以下是我使用它的一個簡單範例:

var Renderer = new ChromePdfRenderer();
string htmlContent = @"
    <html>
    <body>
        <h1>Dynamic Chart</h1>
        <canvas id='myChart'></canvas>
        <script src='https://cdn.jsdelivr.net/npm/chart.js'></script>
        <script>
            var ctx = document.getElementById('myChart').getContext('2d');
            new Chart(ctx, {
                type: 'bar',
                data: {
                    labels: ['Red', 'Blue', 'Yellow', 'Green', 'Purple', 'Orange'],
                    datasets: [{
                        label: '# of Votes',
                        data: [12, 19, 3, 5, 2, 3],
                        backgroundColor: [
                            'rgba(255, 99, 132, 0.2)',
                            'rgba(54, 162, 235, 0.2)',
                            'rgba(255, 206, 86, 0.2)',
                            'rgba(75, 192, 192, 0.2)',
                            'rgba(153, 102, 255, 0.2)',
                            'rgba(255, 159, 64, 0.2)'
                        ],
                        borderColor: [
                            'rgba(255, 99, 132, 1)',
                            'rgba(54, 162, 235, 1)',
                            'rgba(255, 206, 86, 1)',
                            'rgba(75, 192, 192, 1)',
                            'rgba(153, 102, 255, 1)',
                            'rgba(255, 159, 64, 1)'
                        ],
                        borderWidth: 1
                    }]
                },
                options: {
                    scales: {
                        y: {
                            beginAtZero: true
                        }
                    }
                }
            });
        </script>
    </body>
    </html>";
var PDF = Renderer.RenderHtmlAsPdf(htmlContent);
PDF.SaveAs("dynamic_chart.pdf");
var Renderer = new ChromePdfRenderer();
string htmlContent = @"
    <html>
    <body>
        <h1>Dynamic Chart</h1>
        <canvas id='myChart'></canvas>
        <script src='https://cdn.jsdelivr.net/npm/chart.js'></script>
        <script>
            var ctx = document.getElementById('myChart').getContext('2d');
            new Chart(ctx, {
                type: 'bar',
                data: {
                    labels: ['Red', 'Blue', 'Yellow', 'Green', 'Purple', 'Orange'],
                    datasets: [{
                        label: '# of Votes',
                        data: [12, 19, 3, 5, 2, 3],
                        backgroundColor: [
                            'rgba(255, 99, 132, 0.2)',
                            'rgba(54, 162, 235, 0.2)',
                            'rgba(255, 206, 86, 0.2)',
                            'rgba(75, 192, 192, 0.2)',
                            'rgba(153, 102, 255, 0.2)',
                            'rgba(255, 159, 64, 0.2)'
                        ],
                        borderColor: [
                            'rgba(255, 99, 132, 1)',
                            'rgba(54, 162, 235, 1)',
                            'rgba(255, 206, 86, 1)',
                            'rgba(75, 192, 192, 1)',
                            'rgba(153, 102, 255, 1)',
                            'rgba(255, 159, 64, 1)'
                        ],
                        borderWidth: 1
                    }]
                },
                options: {
                    scales: {
                        y: {
                            beginAtZero: true
                        }
                    }
                }
            });
        </script>
    </body>
    </html>";
var PDF = Renderer.RenderHtmlAsPdf(htmlContent);
PDF.SaveAs("dynamic_chart.pdf");
$vbLabelText   $csharpLabel

這段程式碼使用 Chart.js 產生帶有動態圖表的 PDF 檔案。 JavaScript 程式碼在 PDF 建立過程中執行,產生包含渲染圖表的 PDF 檔案。 我利用這個功能創建了數據頻繁變化的動態報告,省去了手動更新圖表的麻煩。

C# PDF 函式庫的 APITemplate io 和 IronPDF 比較:圖 5

能夠像本例中的 Chart.js 一樣新增外部腳本,這意味著我可以使用強大的 JavaScript 程式庫在我的 PDF 中建立豐富的動態內容。 此外,該功能允許我在 HTML 中使用 CSS 和響應式設計技術,確保生成的 PDF 在各種裝置和列印格式上看起來都很棒。 我甚至使用媒體查詢,從同一個 HTML 來源建立針對螢幕檢視和列印進行最佳化的 PDF 檔案。

PDF加密與解密

在我的許多專案中,安全至關重要,尤其是在處理敏感資訊時。 在這些情況下,IronPDF 的加密和解密功能發揮了不可估量的作用。

var pdf = PdfDocument.FromFile("input.pdf");
// Set user password (for opening the document)
pdf.Password = "user_password";
// Set owner password (for editing, printing, etc.)
pdf.OwnerPassword = "owner_password";
// Set specific permissions
pdf.SecuritySettings.AllowUserPrinting = IronPdf.Security.PdfPrintSecurity.NoPrint;
pdf.SecuritySettings.AllowUserCopyPasteContent = false;
pdf.SecuritySettings.AllowUserEdits = IronPdf.Security.PdfEditSecurity.NoEdit;
pdf.SaveAs("highly_secured.pdf");
var pdf = PdfDocument.FromFile("input.pdf");
// Set user password (for opening the document)
pdf.Password = "user_password";
// Set owner password (for editing, printing, etc.)
pdf.OwnerPassword = "owner_password";
// Set specific permissions
pdf.SecuritySettings.AllowUserPrinting = IronPdf.Security.PdfPrintSecurity.NoPrint;
pdf.SecuritySettings.AllowUserCopyPasteContent = false;
pdf.SecuritySettings.AllowUserEdits = IronPdf.Security.PdfEditSecurity.NoEdit;
pdf.SaveAs("highly_secured.pdf");
$vbLabelText   $csharpLabel

C# PDF 函式庫的 APITemplate io 和 IronPDF 比較:圖 6

這段程式碼不僅使用使用者密碼對 PDF 檔案進行加密,還設定了所有者密碼,並對權限進行了精細控制。 我可以明確規定使用者可以對 PDF 檔案執行哪些操作,不能執行哪些操作,例如列印或複製內容。

對於解密,我通常使用這種方法:

try
{
    var pdf = PdfDocument.FromFile("encrypted.pdf", "user_password");
    pdf.SecuritySettings.RemovePasswordsAndEncryption();
    pdf.SaveAs("decrypted.pdf");
    Console.WriteLine("PDF decrypted successfully!");
}
catch (Exception ex)
{
    Console.WriteLine($"Decryption failed: {ex.Message}");
}
try
{
    var pdf = PdfDocument.FromFile("encrypted.pdf", "user_password");
    pdf.SecuritySettings.RemovePasswordsAndEncryption();
    pdf.SaveAs("decrypted.pdf");
    Console.WriteLine("PDF decrypted successfully!");
}
catch (Exception ex)
{
    Console.WriteLine($"Decryption failed: {ex.Message}");
}
$vbLabelText   $csharpLabel

這段程式碼嘗試使用使用者密碼開啟一個加密的PDF文件,移除所有安全限制,並將其儲存為新的未加密文件。 try-catch區塊用來處理密碼錯誤的情況。

我曾在各種場景中使用過這些功能,例如建立安全的文件管理系統,其中不同的使用者對 PDF 文件擁有不同的存取權限。 例如,在醫療記錄系統中,我確保敏感的患者資訊經過加密,並且只有授權人員才能存取。

PDF壓縮

處理大量 PDF 文件時,文件大小就成了關鍵因素。 IronPDF 的壓縮功能在應對儲存和頻寬限制方面發揮了至關重要的作用。

以下是我使用壓縮技術的更進階範例:

using IronPdf;
using System.IO;
using PdfDocument = IronPdf.PdfDocument;

var PDF = PdfDocument.FromFile(@"F:/Test.pdf");
// Compress images
PDF.CompressImages(80); // 80% quality
// Compress fonts
PDF.CompressStructTree();
// Save the compressed PDF
PDF.SaveAs(@"F:/highly_compressed.pdf");
// Compare file sizes
var originalSize = new FileInfo(@"F:/Test.pdf").Length;
var compressedSize = new FileInfo(@"F:/highly_compressed.pdf").Length;
var compressionRatio = (1 - (double)compressedSize / originalSize) * 100;
Console.WriteLine($"Original size: {originalSize / 1024} KB");
Console.WriteLine($"Compressed size: {compressedSize / 1024} KB");
Console.WriteLine($"Compression ratio: {compressionRatio:F2}%");
using IronPdf;
using System.IO;
using PdfDocument = IronPdf.PdfDocument;

var PDF = PdfDocument.FromFile(@"F:/Test.pdf");
// Compress images
PDF.CompressImages(80); // 80% quality
// Compress fonts
PDF.CompressStructTree();
// Save the compressed PDF
PDF.SaveAs(@"F:/highly_compressed.pdf");
// Compare file sizes
var originalSize = new FileInfo(@"F:/Test.pdf").Length;
var compressedSize = new FileInfo(@"F:/highly_compressed.pdf").Length;
var compressionRatio = (1 - (double)compressedSize / originalSize) * 100;
Console.WriteLine($"Original size: {originalSize / 1024} KB");
Console.WriteLine($"Compressed size: {compressedSize / 1024} KB");
Console.WriteLine($"Compression ratio: {compressionRatio:F2}%");
$vbLabelText   $csharpLabel

結果如下:

C# PDF 函式庫的 APITemplate io 和 IronPDF 比較:圖 7

我發現這種技術的組合能夠非常有效地減小文件大小,而不會顯著影響品質。

我曾在多種場景下使用過此功能:

1.電子郵件附件:透過電子郵件傳送 PDF 檔案時,我會對其進行壓縮,以確保它們不會超過附件大小限制。

  1. Web 應用程式:對於需要使用者下載的 PDF 文件,壓縮有助於減少載入時間和頻寬使用。 3.歸檔:當需要長期保存大量 PDF 檔案時,壓縮可以顯著降低儲存成本。

在一個專案中,我為一家律師事務所開發了一套文件管理系統。 他們有數千份 PDF 格式的案件檔案,其中許多是掃描文件,文件體積很大。 透過實施這種壓縮技術,我們將其儲存需求減少了 60% 以上,從而顯著節省了他們的雲端儲存費用。

數位簽名

對於許多業務流程而言,為 PDF 文件添加數位簽章是必不可少的功能,以確保文件的真實性和不可否認性。 IronPDF 讓這項複雜的任務變得異常簡單。 以下是我如何實現數位簽章的更詳細範例:

using IronPdf;
using IronPdf.Signing;

var renderer = new ChromePdfRenderer();
var pdf = PdfDocument.FromFile(@"F:/Contract.pdf");
var signature = new IronPdf.Signing.PdfSignature(@"F:/Iron.pfx", "123")
{
    // Step 3. Optional signing options and a handwritten signature graphic
    SigningContact = "support@ironsoftware.com",
    SigningLocation = "New York, USA",
    SigningReason = "Signing PDF"
};
pdf.Sign(signature);
pdf.SaveAs(@"F:/signed.pdf");
using IronPdf;
using IronPdf.Signing;

var renderer = new ChromePdfRenderer();
var pdf = PdfDocument.FromFile(@"F:/Contract.pdf");
var signature = new IronPdf.Signing.PdfSignature(@"F:/Iron.pfx", "123")
{
    // Step 3. Optional signing options and a handwritten signature graphic
    SigningContact = "support@ironsoftware.com",
    SigningLocation = "New York, USA",
    SigningReason = "Signing PDF"
};
pdf.Sign(signature);
pdf.SaveAs(@"F:/signed.pdf");
$vbLabelText   $csharpLabel

我已在多個實際應用中使用過此功能:

1.合約管理系統:我們為一家需要以電子方式發送和接收已簽署合約的公司實施了該系統。 數位簽名確保了合約的法律效力。 2.醫療記錄系統:在醫療保健應用中,我們使用數位簽名,使醫生能夠簽署病患記錄和處方。 3.政府文件處理:我們為一個政府機構實施了一個系統,該系統可以對官方文件進行數位簽署。

PDF拆分和合併

拆分和合併 PDF 文件的功能是我在文件管理系統中經常使用的基本功能。 IronPDF 對這些功能的實現既強大又靈活。 以下是一個更進階的PDF拆分和合併範例:

using IronPdf;
class Program
{
    static void Main(string[] args)
    {
        // Create first PDF with three pages
        const string html_a = @"
            <h1>Document A</h1>
            <p>This is the first page of Document A.</p>
            <div style='page-break-after: always;'></div>
            <h2>Document A - Page 2</h2>
            <p>This is the second page of Document A.</p>
            <div style='page-break-after: always;'></div>
            <h2>Document A - Page 3</h2>
            <p>This is the third and final page of Document A.</p>";
        // Create second PDF with two pages
        const string html_b = @"
            <h1>Document B</h1>
            <p>Welcome to the first page of Document B.</p>
            <div style='page-break-after: always;'></div>
            <h2>Document B - Page 2</h2>
            <p>This is the second and last page of Document B.</p>";
        // Render HTML to PDF
        var renderer = new ChromePdfRenderer();
        var pdfdoc_a = renderer.RenderHtmlAsPdf(html_a);
        var pdfdoc_b = renderer.RenderHtmlAsPdf(html_b);
        // Merge PDFs
        var merged = PdfDocument.Merge(pdfdoc_a, pdfdoc_b);
        merged.SaveAs(@"F:/IronPdf/MergedDocument.pdf");
        Console.WriteLine("Merged PDF created: MergedDocument.pdf");
        // Load the merged PDF
        var pdf = PdfDocument.FromFile(@"F:/IronPdf/MergedDocument.pdf");
        // Extract the first page
        var firstPage = pdf.CopyPage(0);
        firstPage.SaveAs(@"F:/IronPdf/FirstPageOnly.pdf");
        Console.WriteLine("First page extracted: FirstPageOnly.pdf");
        // Extract pages 2 to 4 (note: index starts at 0)
        var middlePages = pdf.CopyPages(1, 3);
        middlePages.SaveAs(@"F:/IronPdf/Pages2to4.pdf");
        Console.WriteLine("Pages 2 to 4 extracted: Pages2to4.pdf");
        Console.WriteLine("Process completed. Press any key to exit.");
        Console.ReadKey();
    }
}
using IronPdf;
class Program
{
    static void Main(string[] args)
    {
        // Create first PDF with three pages
        const string html_a = @"
            <h1>Document A</h1>
            <p>This is the first page of Document A.</p>
            <div style='page-break-after: always;'></div>
            <h2>Document A - Page 2</h2>
            <p>This is the second page of Document A.</p>
            <div style='page-break-after: always;'></div>
            <h2>Document A - Page 3</h2>
            <p>This is the third and final page of Document A.</p>";
        // Create second PDF with two pages
        const string html_b = @"
            <h1>Document B</h1>
            <p>Welcome to the first page of Document B.</p>
            <div style='page-break-after: always;'></div>
            <h2>Document B - Page 2</h2>
            <p>This is the second and last page of Document B.</p>";
        // Render HTML to PDF
        var renderer = new ChromePdfRenderer();
        var pdfdoc_a = renderer.RenderHtmlAsPdf(html_a);
        var pdfdoc_b = renderer.RenderHtmlAsPdf(html_b);
        // Merge PDFs
        var merged = PdfDocument.Merge(pdfdoc_a, pdfdoc_b);
        merged.SaveAs(@"F:/IronPdf/MergedDocument.pdf");
        Console.WriteLine("Merged PDF created: MergedDocument.pdf");
        // Load the merged PDF
        var pdf = PdfDocument.FromFile(@"F:/IronPdf/MergedDocument.pdf");
        // Extract the first page
        var firstPage = pdf.CopyPage(0);
        firstPage.SaveAs(@"F:/IronPdf/FirstPageOnly.pdf");
        Console.WriteLine("First page extracted: FirstPageOnly.pdf");
        // Extract pages 2 to 4 (note: index starts at 0)
        var middlePages = pdf.CopyPages(1, 3);
        middlePages.SaveAs(@"F:/IronPdf/Pages2to4.pdf");
        Console.WriteLine("Pages 2 to 4 extracted: Pages2to4.pdf");
        Console.WriteLine("Process completed. Press any key to exit.");
        Console.ReadKey();
    }
}
$vbLabelText   $csharpLabel

C# PDF 函式庫的 APITemplate io 和 IronPDF 比較:圖 8

以下是程式碼產生的合併文件:

C# PDF 函式庫的 APITemplate io 和 IronPDF 比較:圖 9

表格填寫

在我的許多專案中,表單自動填寫大大節省了時間。 IronPDF 讓我以程式方式填寫 PDF 表單,這對於處理大量表單或建立個人化文件來說非常寶貴。 以下是一個更全面的表格填寫範例:

using IronPdf;
using System;

// Load the combined form
PdfDocument pdf = PdfDocument.FromFile(@"F:/completeForm.pdf");

// Handle radio buttons
var radioForm = pdf.Form.FindFormField("traveltype");
radioForm.Value = "Airplane";

// Handle checkbox
var checkboxForm = pdf.Form.FindFormField("taskCompleted");
checkboxForm.Value = "Yes";

// Handle combobox
var comboboxForm = pdf.Form.FindFormField("priority");
comboboxForm.Value = "Low";

// Print out all the available choices for combobox
foreach (var choice in comboboxForm.Choices)
{
    Console.WriteLine(choice);
}

// Handle text inputs
pdf.Form.FindFormField("firstname").Value = "John";
pdf.Form.FindFormField("lastname").Value = "Smith";

// Handle text area
pdf.Form.FindFormField("address").Value = "Iron Software\r\n205 N. Michigan Ave.";

// Save the edited PDF
pdf.SaveAs(@"F:/completeFormEdited.pdf");
using IronPdf;
using System;

// Load the combined form
PdfDocument pdf = PdfDocument.FromFile(@"F:/completeForm.pdf");

// Handle radio buttons
var radioForm = pdf.Form.FindFormField("traveltype");
radioForm.Value = "Airplane";

// Handle checkbox
var checkboxForm = pdf.Form.FindFormField("taskCompleted");
checkboxForm.Value = "Yes";

// Handle combobox
var comboboxForm = pdf.Form.FindFormField("priority");
comboboxForm.Value = "Low";

// Print out all the available choices for combobox
foreach (var choice in comboboxForm.Choices)
{
    Console.WriteLine(choice);
}

// Handle text inputs
pdf.Form.FindFormField("firstname").Value = "John";
pdf.Form.FindFormField("lastname").Value = "Smith";

// Handle text area
pdf.Form.FindFormField("address").Value = "Iron Software\r\n205 N. Michigan Ave.";

// Save the edited PDF
pdf.SaveAs(@"F:/completeFormEdited.pdf");
$vbLabelText   $csharpLabel

我已在多個實際應用中使用過此功能:

1.人力資源入職系統:我們創建了一個系統,可以根據人力資源資料庫中的資訊自動填寫新員工的文書,節省了大量的人工資料輸入時間。

2.保險理賠處理:我們為一家保險公司建立了一個系統,該系統可以預先填寫保單持有人資訊理賠表格,從而大大加快了理賠提交流程。

3.學校申請系統:在一個教育計畫中,我們實施了一個根據學生資料填寫學校申請表的系統,讓學生和行政人員的申請過程都更加輕鬆。

4.稅務表格產生:我們為一家會計事務所創建了一個系統,該系統可以根據客戶的財務數據自動填寫稅務表格,從而減少報稅季的錯誤並節省時間。

以程式方式填寫表單的能力是實現許多業務流程自動化的關鍵因素,從而顯著節省了時間並減少了手動資料輸入造成的錯誤。

水印

在 PDF 文件中加入浮水印通常是出於品牌推廣、安全防護或狀態指示的需要。 IronPDF 提供了靈活的浮水印功能,我在許多專案中都發現它非常有用。 以下是我如何使用浮水印的更詳細範例:

using IronPdf;
using IronSoftware.Drawing;

string watermarkHtml = @"
<img style='width: 250px;' src='https://ironsoftware.com/img/products/ironpdf-logo-text-dotnet.svg'>
<h1>Iron Software</h1>";

ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>Watermark</h1>");

// Apply watermark with 45 degrees rotation and 70% opacity
pdf.ApplyWatermark(watermarkHtml, rotation: 30, opacity: 90);
pdf.SaveAs("watermarkOpacity&amp;Rotation.pdf");
using IronPdf;
using IronSoftware.Drawing;

string watermarkHtml = @"
<img style='width: 250px;' src='https://ironsoftware.com/img/products/ironpdf-logo-text-dotnet.svg'>
<h1>Iron Software</h1>";

ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>Watermark</h1>");

// Apply watermark with 45 degrees rotation and 70% opacity
pdf.ApplyWatermark(watermarkHtml, rotation: 30, opacity: 90);
pdf.SaveAs("watermarkOpacity&amp;Rotation.pdf");
$vbLabelText   $csharpLabel

C# PDF 函式庫的 APITemplate io 和 IronPDF 比較:圖 10

API範本進階功能

動態模板生成

APITemplate 的動態範本產生功能非常強大,它允許使用自訂 JSON 資料建立高度可自訂的文件。 APITemplate 的 API 支援動態元件。 你可以獲得程式碼的 PDF 和影像輸出結果。 在 API 控制台中,我可以使用 WYSIWYG 編輯器輕鬆產生 PDF 文件。

讓我們來看看我是如何在專案中運用這項技術的。

using System;
using System.IO;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;

namespace csharp
{
    class ReturnContent
    {
        public string download_url { get; set; }
        public string status { get; set; }
    }

    class Program
    {
        static async Task Main(string[] args)
        {
            var api_key = "a9e4MjA2NTg6MTc3Njk6Uk1ZSzVjTWs1T3d6VE9Mdw=";
            var template_id = "bf077b23b4a407ae";
            var url = $"https://rest.apitemplate.io/v2/create-pdf?template_id={template_id}";
            var data = new
            {
                date = "15/05/2022",
                invoice_no = "435568799",
                sender_address1 = "3244 Jurong Drive",
                sender_address2 = "Falmouth Maine 1703",
                sender_phone = "255-781-6789",
                sender_email = "dev@ironsoftware.com",
                rece_addess1 = "2354 Lakeside Drive",
                rece_addess2 = "New York 234562 ",
                rece_phone = "34333-84-223",
                rece_email = "info@ironsoftware.com",
                items = new[]
                {
                    new { item_name = "Oil", unit = 1, unit_price = 100, total = 100 },
                    new { item_name = "Rice", unit = 2, unit_price = 200, total = 400 },
                    new { item_name = "Orange", unit = 7, unit_price = 20, total = 1400 }
                },
                total = "total",
                footer_email = "info@ironsoftware.com"
            };
            var json_content = JsonSerializer.Serialize(data);
            var buffer = System.Text.Encoding.UTF8.GetBytes(json_content);
            var byteContent = new ByteArrayContent(buffer);
            Console.WriteLine(json_content);
            var client = new HttpClient();
            client.DefaultRequestHeaders.Add("X-API-KEY", api_key);
            var response = await client.PostAsync(url, byteContent);
            var ret = await response.Content.ReadAsStringAsync();
            var returnContent = JsonSerializer.Deserialize<ReturnContent>(ret);
            if (returnContent.status == "success")
            {
                Console.WriteLine($"Downloading {returnContent.download_url}...");
                var download_response = await client.GetAsync(returnContent.download_url);
                using (var stream = await download_response.Content.ReadAsStreamAsync())
                {
                    var fileInfo = new FileInfo(@"F:/generated_document.pdf");
                    using (var fileStream = fileInfo.OpenWrite())
                    {
                        await stream.CopyToAsync(fileStream);
                    }
                }
                Console.WriteLine("PDF file has been downloaded and saved as 'generated_document.pdf'");
            }
        }
    }
}
using System;
using System.IO;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;

namespace csharp
{
    class ReturnContent
    {
        public string download_url { get; set; }
        public string status { get; set; }
    }

    class Program
    {
        static async Task Main(string[] args)
        {
            var api_key = "a9e4MjA2NTg6MTc3Njk6Uk1ZSzVjTWs1T3d6VE9Mdw=";
            var template_id = "bf077b23b4a407ae";
            var url = $"https://rest.apitemplate.io/v2/create-pdf?template_id={template_id}";
            var data = new
            {
                date = "15/05/2022",
                invoice_no = "435568799",
                sender_address1 = "3244 Jurong Drive",
                sender_address2 = "Falmouth Maine 1703",
                sender_phone = "255-781-6789",
                sender_email = "dev@ironsoftware.com",
                rece_addess1 = "2354 Lakeside Drive",
                rece_addess2 = "New York 234562 ",
                rece_phone = "34333-84-223",
                rece_email = "info@ironsoftware.com",
                items = new[]
                {
                    new { item_name = "Oil", unit = 1, unit_price = 100, total = 100 },
                    new { item_name = "Rice", unit = 2, unit_price = 200, total = 400 },
                    new { item_name = "Orange", unit = 7, unit_price = 20, total = 1400 }
                },
                total = "total",
                footer_email = "info@ironsoftware.com"
            };
            var json_content = JsonSerializer.Serialize(data);
            var buffer = System.Text.Encoding.UTF8.GetBytes(json_content);
            var byteContent = new ByteArrayContent(buffer);
            Console.WriteLine(json_content);
            var client = new HttpClient();
            client.DefaultRequestHeaders.Add("X-API-KEY", api_key);
            var response = await client.PostAsync(url, byteContent);
            var ret = await response.Content.ReadAsStringAsync();
            var returnContent = JsonSerializer.Deserialize<ReturnContent>(ret);
            if (returnContent.status == "success")
            {
                Console.WriteLine($"Downloading {returnContent.download_url}...");
                var download_response = await client.GetAsync(returnContent.download_url);
                using (var stream = await download_response.Content.ReadAsStreamAsync())
                {
                    var fileInfo = new FileInfo(@"F:/generated_document.pdf");
                    using (var fileStream = fileInfo.OpenWrite())
                    {
                        await stream.CopyToAsync(fileStream);
                    }
                }
                Console.WriteLine("PDF file has been downloaded and saved as 'generated_document.pdf'");
            }
        }
    }
}
$vbLabelText   $csharpLabel

C# PDF 函式庫的 APITemplate io 和 IronPDF 比較:圖 11

這是生成的PDF文件:

C# PDF 函式庫的 APITemplate io 和 IronPDF 比較:圖 12

批量生成 PDF

APITemplate 的批次 PDF 產生功能在一次 API 呼叫中建立多個文件時具有顯著優勢。 以下是我如何使用它的更詳細範例:

using System;
using System.IO;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;
using System.Collections.Generic;

namespace csharp
{
    class ReturnContent
    {
        public string download_url { get; set; }
        public string status { get; set; }
    }

    class Program
    {
        static async Task Main(string[] args)
        {
            var api_key = "a9e4MjA2NTg6MTc3Njk6Uk1ZSzVjTWs1T3d6VE9Mdw=";
            var template_id = "d4f77b23b4ab09fa";
            var url = $"https://rest.apitemplate.io/v2/create-pdf?template_id={template_id}";
            var membershipCards = new List<object>
            {
                new { name = "Iron Dev 1", email = "dev1@ironsoftware.com", membership_id = "M001", expiry_date = "2024-12-31" },
                new { name = "Iron Dev 2", email = "dev2@ironsoftware.com", membership_id = "M002", expiry_date = "2025-06-30" },
                new { name = "Iron Dev 3", email = "dev3@ironsoftware.com", membership_id = "M003", expiry_date = "2024-09-15" }
            };
            var client = new HttpClient();
            client.DefaultRequestHeaders.Add("X-API-KEY", api_key);
            for (int i = 0; i < membershipCards.Count; i++)
            {
                var json_content = JsonSerializer.Serialize(membershipCards[i]);
                var buffer = System.Text.Encoding.UTF8.GetBytes(json_content);
                var byteContent = new ByteArrayContent(buffer);
                Console.WriteLine($"Creating PDF for {((dynamic)membershipCards[i]).name}...");
                var response = await client.PostAsync(url, byteContent);
                var ret = await response.Content.ReadAsStringAsync();
                var returnContent = JsonSerializer.Deserialize<ReturnContent>(ret);
                if (returnContent.status == "success")
                {
                    Console.WriteLine($"Downloading {returnContent.download_url}...");
                    var download_response = await client.GetAsync(returnContent.download_url);
                    using (var stream = await download_response.Content.ReadAsStreamAsync())
                    {
                        var fileInfo = new FileInfo($"F:/membership_card_{i + 1}.pdf");
                        using (var fileStream = fileInfo.OpenWrite())
                        {
                            await stream.CopyToAsync(fileStream);
                        }
                    }
                    Console.WriteLine($"PDF file has been downloaded and saved as 'membership_card_{i + 1}.pdf'");
                }
                else
                {
                    Console.WriteLine($"Failed to create PDF for {((dynamic)membershipCards[i]).name}. Status: {returnContent.status}");
                }
            }
        }
    }
}
using System;
using System.IO;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;
using System.Collections.Generic;

namespace csharp
{
    class ReturnContent
    {
        public string download_url { get; set; }
        public string status { get; set; }
    }

    class Program
    {
        static async Task Main(string[] args)
        {
            var api_key = "a9e4MjA2NTg6MTc3Njk6Uk1ZSzVjTWs1T3d6VE9Mdw=";
            var template_id = "d4f77b23b4ab09fa";
            var url = $"https://rest.apitemplate.io/v2/create-pdf?template_id={template_id}";
            var membershipCards = new List<object>
            {
                new { name = "Iron Dev 1", email = "dev1@ironsoftware.com", membership_id = "M001", expiry_date = "2024-12-31" },
                new { name = "Iron Dev 2", email = "dev2@ironsoftware.com", membership_id = "M002", expiry_date = "2025-06-30" },
                new { name = "Iron Dev 3", email = "dev3@ironsoftware.com", membership_id = "M003", expiry_date = "2024-09-15" }
            };
            var client = new HttpClient();
            client.DefaultRequestHeaders.Add("X-API-KEY", api_key);
            for (int i = 0; i < membershipCards.Count; i++)
            {
                var json_content = JsonSerializer.Serialize(membershipCards[i]);
                var buffer = System.Text.Encoding.UTF8.GetBytes(json_content);
                var byteContent = new ByteArrayContent(buffer);
                Console.WriteLine($"Creating PDF for {((dynamic)membershipCards[i]).name}...");
                var response = await client.PostAsync(url, byteContent);
                var ret = await response.Content.ReadAsStringAsync();
                var returnContent = JsonSerializer.Deserialize<ReturnContent>(ret);
                if (returnContent.status == "success")
                {
                    Console.WriteLine($"Downloading {returnContent.download_url}...");
                    var download_response = await client.GetAsync(returnContent.download_url);
                    using (var stream = await download_response.Content.ReadAsStreamAsync())
                    {
                        var fileInfo = new FileInfo($"F:/membership_card_{i + 1}.pdf");
                        using (var fileStream = fileInfo.OpenWrite())
                        {
                            await stream.CopyToAsync(fileStream);
                        }
                    }
                    Console.WriteLine($"PDF file has been downloaded and saved as 'membership_card_{i + 1}.pdf'");
                }
                else
                {
                    Console.WriteLine($"Failed to create PDF for {((dynamic)membershipCards[i]).name}. Status: {returnContent.status}");
                }
            }
        }
    }
}
$vbLabelText   $csharpLabel

這段程式碼透過一次 API 呼叫產生多張會員卡。 每張卡片都根據會員的個人資訊進行客製化。 這是這段程式碼產生的一張卡片:

C# PDF 函式庫的 APITemplate io 和 IronPDF 比較:圖 13

影像生成

雖然 APITemplate 的主要功能是產生 PDF 文件,但它的圖像生成能力同樣令人印象深刻。您可以使用控制台中的圖像模板產生社交媒體圖片。 它還提供響應式影像智慧裁剪功能。橫幅產生 API 與圖像 API 相同。 以下是我如何使用它的一個更複雜的例子:

using System;
using System.IO;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

namespace csharp
{
    class ReturnContent
    {
        public string download_url { get; set; }
        public string status { get; set; }
    }

    class Program
    {
        static async Task Main(string[] args)
        {
            var api_key = "a9e4MjA2NTg6MTc3Njk6Uk1ZSzVjTWs1T3d6VE9Mdw=";
            var template_id = "f4377b23b4aeeed0";
            var url = $"https://rest.apitemplate.io/v2/create-image?template_id={template_id}";
            var json_content = @"{
    ""overrides"": [
        {
            ""name"": ""rect_image_bg"",
            ""stroke"": ""grey"",
            ""src"": ""https://images.unsplash.com/photo-1542401886-65d6c61db217?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwxOTc1MDZ8MHwxfHNlYXJjaHwzfHxkZXNlcnR8ZW58MHwwfHx8MTYyMTUxOTI2OA&ixlib=rb-1.2.1&q=80&w=1080""
        },
        {
            ""name"": ""rect_container"",
            ""stroke"": ""grey"",
            ""backgroundColor"": ""rgba(255, 255, 255, 0.62)""
        },
        {
            ""name"": ""text_quote"",
            ""text"": ""Just witnessed the most breathtaking sunset over the Sahara. The way the light dances on the dunes, painting the sky in shades of orange and purple, is truly magical. Nature's artistry at its finest!  #DesertAdventures #SaharaSkies"",
            ""textBackgroundColor"": ""rgba(246, 243, 243, 0)"",
            ""color"": ""#414141""
        },
        {
            ""name"": ""text_footer"",
            ""text"": ""2024-07-30 - Twitter - iPhone 16 Pro"",
            ""textBackgroundColor"": ""rgba(246, 243, 243, 0)"",
            ""color"": ""#666666""
        },
        {
            ""name"": ""circle_profile"",
            ""stroke"": ""grey"",
            ""src"": ""https://images.unsplash.com/photo-1520998116484-6eeb2f72b5b9?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwxOTc1MDZ8MHwxfHNlYXJjaHw2Mnx8aGFwcHl8ZW58MHwwfHx8MTYyMTY5MjkwNw&ixlib=rb-1.2.1&q=80&w=1080""
        },
        {
            ""name"": ""text_name"",
            ""text"": ""Sarah Wanderlust"",
            ""textBackgroundColor"": ""rgba(246, 243, 243, 0)"",
            ""color"": ""#4E4E4E""
        },
        {
            ""name"": ""text_twitter"",
            ""text"": ""@sarahexplores"",
            ""textBackgroundColor"": ""rgba(246, 243, 243, 0)"",
            ""color"": ""#4E4E4E""
        }
    ]
}";
            var buffer = System.Text.Encoding.UTF8.GetBytes(json_content);
            var byteContent = new ByteArrayContent(buffer);
            Console.WriteLine(json_content);
            var client = new HttpClient();
            client.DefaultRequestHeaders.Add("X-API-KEY", api_key);
            var response = await client.PostAsync(url, byteContent);
            var ret = await response.Content.ReadAsStringAsync();
            var returnContent = JsonSerializer.Deserialize<ReturnContent>(ret);
            if (returnContent.status == "success")
            {
                Console.WriteLine($"Downloading {returnContent.download_url}...");
                var download_response = await client.GetAsync(returnContent.download_url);
                using (var stream = await download_response.Content.ReadAsStreamAsync())
                {
                    var fileInfo = new FileInfo("image.jpeg");
                    using (var fileStream = fileInfo.OpenWrite())
                    {
                        await stream.CopyToAsync(fileStream);
                    }
                }
            }
        }
    }
}
using System;
using System.IO;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

namespace csharp
{
    class ReturnContent
    {
        public string download_url { get; set; }
        public string status { get; set; }
    }

    class Program
    {
        static async Task Main(string[] args)
        {
            var api_key = "a9e4MjA2NTg6MTc3Njk6Uk1ZSzVjTWs1T3d6VE9Mdw=";
            var template_id = "f4377b23b4aeeed0";
            var url = $"https://rest.apitemplate.io/v2/create-image?template_id={template_id}";
            var json_content = @"{
    ""overrides"": [
        {
            ""name"": ""rect_image_bg"",
            ""stroke"": ""grey"",
            ""src"": ""https://images.unsplash.com/photo-1542401886-65d6c61db217?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwxOTc1MDZ8MHwxfHNlYXJjaHwzfHxkZXNlcnR8ZW58MHwwfHx8MTYyMTUxOTI2OA&ixlib=rb-1.2.1&q=80&w=1080""
        },
        {
            ""name"": ""rect_container"",
            ""stroke"": ""grey"",
            ""backgroundColor"": ""rgba(255, 255, 255, 0.62)""
        },
        {
            ""name"": ""text_quote"",
            ""text"": ""Just witnessed the most breathtaking sunset over the Sahara. The way the light dances on the dunes, painting the sky in shades of orange and purple, is truly magical. Nature's artistry at its finest!  #DesertAdventures #SaharaSkies"",
            ""textBackgroundColor"": ""rgba(246, 243, 243, 0)"",
            ""color"": ""#414141""
        },
        {
            ""name"": ""text_footer"",
            ""text"": ""2024-07-30 - Twitter - iPhone 16 Pro"",
            ""textBackgroundColor"": ""rgba(246, 243, 243, 0)"",
            ""color"": ""#666666""
        },
        {
            ""name"": ""circle_profile"",
            ""stroke"": ""grey"",
            ""src"": ""https://images.unsplash.com/photo-1520998116484-6eeb2f72b5b9?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwxOTc1MDZ8MHwxfHNlYXJjaHw2Mnx8aGFwcHl8ZW58MHwwfHx8MTYyMTY5MjkwNw&ixlib=rb-1.2.1&q=80&w=1080""
        },
        {
            ""name"": ""text_name"",
            ""text"": ""Sarah Wanderlust"",
            ""textBackgroundColor"": ""rgba(246, 243, 243, 0)"",
            ""color"": ""#4E4E4E""
        },
        {
            ""name"": ""text_twitter"",
            ""text"": ""@sarahexplores"",
            ""textBackgroundColor"": ""rgba(246, 243, 243, 0)"",
            ""color"": ""#4E4E4E""
        }
    ]
}";
            var buffer = System.Text.Encoding.UTF8.GetBytes(json_content);
            var byteContent = new ByteArrayContent(buffer);
            Console.WriteLine(json_content);
            var client = new HttpClient();
            client.DefaultRequestHeaders.Add("X-API-KEY", api_key);
            var response = await client.PostAsync(url, byteContent);
            var ret = await response.Content.ReadAsStringAsync();
            var returnContent = JsonSerializer.Deserialize<ReturnContent>(ret);
            if (returnContent.status == "success")
            {
                Console.WriteLine($"Downloading {returnContent.download_url}...");
                var download_response = await client.GetAsync(returnContent.download_url);
                using (var stream = await download_response.Content.ReadAsStreamAsync())
                {
                    var fileInfo = new FileInfo("image.jpeg");
                    using (var fileStream = fileInfo.OpenWrite())
                    {
                        await stream.CopyToAsync(fileStream);
                    }
                }
            }
        }
    }
}
$vbLabelText   $csharpLabel

C# PDF 函式庫的 APITemplate io 和 IronPDF 比較:圖 14

此範例產生具有動態內容、自訂背景顏色和嵌入式產品圖像的產品宣傳圖像。

二維碼生成

APITemplate 內建的二維碼產生功能大大提升了我的許多專案效率。 您可以將資料網址替換為二維碼的內容。 以下是我如何使用它的一個更複雜的例子:

using System;
using System.IO;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

namespace csharp
{
    class ReturnContent
    {
        public string download_url { get; set; }
        public string status { get; set; }
    }

    class Program
    {
        static async Task Main(string[] args)
        {
            var api_key = "API-Key";
            var template_id = "Template-Key";
            var url = $"https://rest.apitemplate.io/v2/create-image?template_id={template_id}";
            var json_content = @"{
    ""overrides"": [
        {
            ""name"": ""background-color"",
            ""stroke"": ""grey"",
            ""backgroundColor"": ""#FFFFFF""
        },
        {
            ""name"": ""qr_1"",
            ""content"": ""http://ironpdf.com/"",
            ""backgroundColor"": ""white"",
            ""color"": ""#000000""
        }
    ]
}";
            var buffer = System.Text.Encoding.UTF8.GetBytes(json_content);
            var byteContent = new ByteArrayContent(buffer);
            //Console.WriteLine(json_content);
            var client = new HttpClient();
            client.DefaultRequestHeaders.Add("X-API-KEY", api_key);
            var response = await client.PostAsync(url, byteContent);
            var ret = await response.Content.ReadAsStringAsync();
            var returnContent = JsonSerializer.Deserialize<ReturnContent>(ret);
            Console.WriteLine(returnContent.status);
            if (returnContent.status == "success")
            {
                Console.WriteLine($"Downloading {returnContent.download_url}...");
                var download_response = await client.GetAsync(returnContent.download_url);
                using (var stream = await download_response.Content.ReadAsStreamAsync())
                {
                    var fileInfo = new FileInfo(@"F:/QRimage.jpeg");
                    using (var fileStream = fileInfo.OpenWrite())
                    {
                        await stream.CopyToAsync(fileStream);
                    }
                }
            }
        }
    }
}
using System;
using System.IO;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

namespace csharp
{
    class ReturnContent
    {
        public string download_url { get; set; }
        public string status { get; set; }
    }

    class Program
    {
        static async Task Main(string[] args)
        {
            var api_key = "API-Key";
            var template_id = "Template-Key";
            var url = $"https://rest.apitemplate.io/v2/create-image?template_id={template_id}";
            var json_content = @"{
    ""overrides"": [
        {
            ""name"": ""background-color"",
            ""stroke"": ""grey"",
            ""backgroundColor"": ""#FFFFFF""
        },
        {
            ""name"": ""qr_1"",
            ""content"": ""http://ironpdf.com/"",
            ""backgroundColor"": ""white"",
            ""color"": ""#000000""
        }
    ]
}";
            var buffer = System.Text.Encoding.UTF8.GetBytes(json_content);
            var byteContent = new ByteArrayContent(buffer);
            //Console.WriteLine(json_content);
            var client = new HttpClient();
            client.DefaultRequestHeaders.Add("X-API-KEY", api_key);
            var response = await client.PostAsync(url, byteContent);
            var ret = await response.Content.ReadAsStringAsync();
            var returnContent = JsonSerializer.Deserialize<ReturnContent>(ret);
            Console.WriteLine(returnContent.status);
            if (returnContent.status == "success")
            {
                Console.WriteLine($"Downloading {returnContent.download_url}...");
                var download_response = await client.GetAsync(returnContent.download_url);
                using (var stream = await download_response.Content.ReadAsStreamAsync())
                {
                    var fileInfo = new FileInfo(@"F:/QRimage.jpeg");
                    using (var fileStream = fileInfo.OpenWrite())
                    {
                        await stream.CopyToAsync(fileStream);
                    }
                }
            }
        }
    }
}
$vbLabelText   $csharpLabel

C# PDF 函式庫的 APITemplate io 和 IronPDF 比較:圖 15

文件和支援

作為一名經常從事 PDF 生成和處理的 C# 開發人員,我發現文件和支援的品質可以決定一個專案的成敗。 讓我們來探討一下我使用 IronPDF 和 APITemplate 的文檔和獲得支援的體驗。

IronPDF

文件

IronPDF 的文件內容全面且架構清晰,這對我進行專案有了很大的幫助。 以下是我使用體驗的詳細分析:IronPDF 文件可在以下網址取得:https://ironpdf.com/docs/而且內容相當豐富。以下是我比較欣賞的幾個面向:

1.入門指南:文件首先提供了一個清晰的逐步指南,指導如何透過 NuGet 安裝 IronPDF 並建立您的第一個 PDF。 這幫助我快速啟動並開展了最初的專案。

  1. API 參考: API 參考非常詳盡,涵蓋所有類別和方法。 每個條目都包含 C# 範例,我在實現特定功能時發現這些範例非常有價值。

3.程式碼範例:整個文件中提供了大量的程式碼片段和完整範例。 當需要實作更複雜的 PDF 操作時,這些工具特別有用。

4.教學與操作指南: IronPDF 提供詳細的教學課程,指導使用者完成常見任務,例如從 HTML 建立 PDF、新增浮水印或使用表單。 這些指導我了解了更高階的使用案例。

5.故障排除部分:文件包含故障排除部分,其中解決了常見問題。 這在我遇到錯誤或意外情況時節省了我的時間。

支援

據我所知,IronPDF 的客服反應迅速,支援管道也極為有用:

1.電子郵件支援:當我遇到複雜問題時,我使用了他們的電子郵件支援。 回應時間通常在 24 小時內,而且支援團隊對產品非常了解。

2.社區論壇: IronPDF 維護一個社區論壇,開發者可以提問和分享解決方案。 我既找到了自己問題的答案,也根據自己的經驗提出了解決方案。

  1. Stack Overflow: IronPDF 團隊積極監控 Stack Overflow 上的 [ironpdf] 標籤。 我在那裡發布的問題都得到了很有幫助的回應。

4.定期更新: IronPDF 經常發布更新,修復錯誤並增加新功能。 更新日誌很詳細,幫助我了解每個版本新增或變更的內容。

5.遷移指南:當主要版本之間存在重大變更時,IronPDF 提供了遷移指南。 這些對於將我的專案更新到庫的最新版本至關重要。

API模板

APITemplate 的文檔和支援結構與 IronPDF 不同,這反映了它作為雲端服務的性質。以下是我的經驗:

文件

APITemplate 的文檔位於https://docs.apitemplate.io/reference/api-reference.html它專注於 API 的使用。 以下是重點:

  1. API 參考:此文件提供了清晰的 API 參考,詳細說明了所有可用的端點、必要的參數和回應格式。 在將 APITemplate 整合到我的 C# 應用程式中時,這一直是我的首選資源。

2.身份驗證:有一個專門的身份驗證章節,清楚地解釋如何使用 API 金鑰。 這在我剛開始使用這項服務時至關重要。

支援

APITemplate 的支援系統更著重於電子郵件支援:

1.電子郵件支援:當我遇到問題或疑問時,我使用了他們的電子郵件支援。 一般情況下,回覆時間為 1-2 個工作天內。

2.常見問題解答部分:文件中包含常見問題部分,解答常見問題。 每當我遇到問題時,這裡通常是我首先會去的地方。

使用 Bootstrap 5 和 IronPDF 建立分析儀表板

IronPDF 的 Chrome V8 渲染引擎擅長渲染現代 Bootstrap 5 佈局,因此非常適合產生包含業務指標和資料視覺化的 PDF 報告。 與 APITemplate 基於 API 的方法不同,IronPDF 直接處理 HTML,並完全支援 CSS3,包括 flexbox、CSS Grid 和自訂屬性。

using IronPdf;

var renderer = new ChromePdfRenderer();

string analyticsDashboard = @"
<!DOCTYPE html>
<html>
<head>
    <meta charset='utf-8'>
    <meta name='viewport' content='width=device-width, initial-scale=1'>
    <link href='https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css' rel='stylesheet'>
    <style>
        .metric-card {
            transition: transform 0.2s;
            border-left: 4px solid #0d6efd;
        }
        .metric-card:hover { transform: translateY(-5px); }
        .trend-up { color: #198754; }
        .trend-down { color: #dc3545; }
        @media print {
            .metric-card { page-break-inside: avoid; }
        }
    </style>
</head>
<body class='bg-light'>
    <div class='container py-5'>
        <div class='row mb-4'>
            <div class='col-12'>
                <div class='card shadow-sm'>
                    <div class='card-body'>
                        <h1 class='display-6 mb-0'>Performance Dashboard</h1>
                        <p class='text-muted mb-0'>Q4 2024 Analytics Overview</p>
                    </div>
                </div>
            </div>
        </div>

        <div class='row g-4 mb-4'>
            <div class='col-md-3'>
                <div class='card metric-card shadow-sm h-100'>
                    <div class='card-body'>
                        <h6 class='text-muted text-uppercase mb-2'>Total Revenue</h6>
                        <h2 class='display-6 mb-3'>$2.4M</h2>
                        <div class='progress' style='height: 6px;'>
                            <div class='progress-bar bg-success' style='width: 85%'></div>
                        </div>
                        <small class='trend-up'>↑ 18% from last quarter</small>
                    </div>
                </div>
            </div>
            <div class='col-md-3'>
                <div class='card metric-card shadow-sm h-100'>
                    <div class='card-body'>
                        <h6 class='text-muted text-uppercase mb-2'>Active Users</h6>
                        <h2 class='display-6 mb-3'>48,592</h2>
                        <div class='progress' style='height: 6px;'>
                            <div class='progress-bar bg-primary' style='width: 72%'></div>
                        </div>
                        <small class='trend-up'>↑ 12% growth rate</small>
                    </div>
                </div>
            </div>
            <div class='col-md-3'>
                <div class='card metric-card shadow-sm h-100'>
                    <div class='card-body'>
                        <h6 class='text-muted text-uppercase mb-2'>Conversion Rate</h6>
                        <h2 class='display-6 mb-3'>3.8%</h2>
                        <div class='progress' style='height: 6px;'>
                            <div class='progress-bar bg-warning' style='width: 38%'></div>
                        </div>
                        <small class='trend-down'>↓ 2% needs attention</small>
                    </div>
                </div>
            </div>
            <div class='col-md-3'>
                <div class='card metric-card shadow-sm h-100'>
                    <div class='card-body'>
                        <h6 class='text-muted text-uppercase mb-2'>Satisfaction</h6>
                        <h2 class='display-6 mb-3'>4.7/5</h2>
                        <div class='progress' style='height: 6px;'>
                            <div class='progress-bar bg-success' style='width: 94%'></div>
                        </div>
                        <small class='trend-up'>↑ Excellent rating</small>
                    </div>
                </div>
            </div>
        </div>

        <div class='card shadow-sm'>
            <div class='card-body'>
                <h5 class='card-title mb-3'>Top Performing Products</h5>
                <div class='table-responsive'>
                    <table class='table table-hover'>
                        <thead class='table-light'>
                            <tr>
                                <th>Product</th>
                                <th>Revenue</th>
                                <th>Units</th>
                                <th>Trend</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td><strong>Enterprise Suite</strong></td>
                                <td>$1,240,000</td>
                                <td>2,150</td>
                                <td><span class='badge bg-success'>+22%</span></td>
                            </tr>
                            <tr>
                                <td><strong>Professional Plan</strong></td>
                                <td>$820,000</td>
                                <td>4,890</td>
                                <td><span class='badge bg-success'>+15%</span></td>
                            </tr>
                            <tr>
                                <td><strong>Starter Package</strong></td>
                                <td>$340,000</td>
                                <td>8,240</td>
                                <td><span class='badge bg-warning'>+5%</span></td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</body>
</html>";

var pdf = renderer.RenderHtmlAsPdf(analyticsDashboard);
pdf.SaveAs("analytics-dashboard.pdf");
using IronPdf;

var renderer = new ChromePdfRenderer();

string analyticsDashboard = @"
<!DOCTYPE html>
<html>
<head>
    <meta charset='utf-8'>
    <meta name='viewport' content='width=device-width, initial-scale=1'>
    <link href='https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css' rel='stylesheet'>
    <style>
        .metric-card {
            transition: transform 0.2s;
            border-left: 4px solid #0d6efd;
        }
        .metric-card:hover { transform: translateY(-5px); }
        .trend-up { color: #198754; }
        .trend-down { color: #dc3545; }
        @media print {
            .metric-card { page-break-inside: avoid; }
        }
    </style>
</head>
<body class='bg-light'>
    <div class='container py-5'>
        <div class='row mb-4'>
            <div class='col-12'>
                <div class='card shadow-sm'>
                    <div class='card-body'>
                        <h1 class='display-6 mb-0'>Performance Dashboard</h1>
                        <p class='text-muted mb-0'>Q4 2024 Analytics Overview</p>
                    </div>
                </div>
            </div>
        </div>

        <div class='row g-4 mb-4'>
            <div class='col-md-3'>
                <div class='card metric-card shadow-sm h-100'>
                    <div class='card-body'>
                        <h6 class='text-muted text-uppercase mb-2'>Total Revenue</h6>
                        <h2 class='display-6 mb-3'>$2.4M</h2>
                        <div class='progress' style='height: 6px;'>
                            <div class='progress-bar bg-success' style='width: 85%'></div>
                        </div>
                        <small class='trend-up'>↑ 18% from last quarter</small>
                    </div>
                </div>
            </div>
            <div class='col-md-3'>
                <div class='card metric-card shadow-sm h-100'>
                    <div class='card-body'>
                        <h6 class='text-muted text-uppercase mb-2'>Active Users</h6>
                        <h2 class='display-6 mb-3'>48,592</h2>
                        <div class='progress' style='height: 6px;'>
                            <div class='progress-bar bg-primary' style='width: 72%'></div>
                        </div>
                        <small class='trend-up'>↑ 12% growth rate</small>
                    </div>
                </div>
            </div>
            <div class='col-md-3'>
                <div class='card metric-card shadow-sm h-100'>
                    <div class='card-body'>
                        <h6 class='text-muted text-uppercase mb-2'>Conversion Rate</h6>
                        <h2 class='display-6 mb-3'>3.8%</h2>
                        <div class='progress' style='height: 6px;'>
                            <div class='progress-bar bg-warning' style='width: 38%'></div>
                        </div>
                        <small class='trend-down'>↓ 2% needs attention</small>
                    </div>
                </div>
            </div>
            <div class='col-md-3'>
                <div class='card metric-card shadow-sm h-100'>
                    <div class='card-body'>
                        <h6 class='text-muted text-uppercase mb-2'>Satisfaction</h6>
                        <h2 class='display-6 mb-3'>4.7/5</h2>
                        <div class='progress' style='height: 6px;'>
                            <div class='progress-bar bg-success' style='width: 94%'></div>
                        </div>
                        <small class='trend-up'>↑ Excellent rating</small>
                    </div>
                </div>
            </div>
        </div>

        <div class='card shadow-sm'>
            <div class='card-body'>
                <h5 class='card-title mb-3'>Top Performing Products</h5>
                <div class='table-responsive'>
                    <table class='table table-hover'>
                        <thead class='table-light'>
                            <tr>
                                <th>Product</th>
                                <th>Revenue</th>
                                <th>Units</th>
                                <th>Trend</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td><strong>Enterprise Suite</strong></td>
                                <td>$1,240,000</td>
                                <td>2,150</td>
                                <td><span class='badge bg-success'>+22%</span></td>
                            </tr>
                            <tr>
                                <td><strong>Professional Plan</strong></td>
                                <td>$820,000</td>
                                <td>4,890</td>
                                <td><span class='badge bg-success'>+15%</span></td>
                            </tr>
                            <tr>
                                <td><strong>Starter Package</strong></td>
                                <td>$340,000</td>
                                <td>8,240</td>
                                <td><span class='badge bg-warning'>+5%</span></td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</body>
</html>";

var pdf = renderer.RenderHtmlAsPdf(analyticsDashboard);
pdf.SaveAs("analytics-dashboard.pdf");
$vbLabelText   $csharpLabel

這段程式碼產生一個專業的分析儀表板 PDF,其中包含指標卡、進度條和響應式表格。 IronPDF 的 Chrome 引擎能夠完美地渲染 Bootstrap 的 flexbox 佈局、陰影和懸停效果——這些功能在使用 APITemplate 等基於 API 的服務時需要大量的自訂工作。

與 APITemplate 相比的主要優點:

  • 直接渲染 HTML,並完全支援 Bootstrap 無需 API 呼叫或模板配置
  • 完全相容於 CSS3,包括動畫效果。
  • 無需外部依賴的離線處理

有關 Bootstrap PDF 產生的更多信息,請參閱HTML 轉 PDF Bootstrap 指南

授權

IronPDF定價和許可

C# PDF 函式庫的 APITemplate io 和 IronPDF 比較:圖 16

IronPDF提供多種價格方案,以滿足不同的需求:

  1. Lite:定價為$799 ,此等級適合單一開發人員處理單一專案。 這是一次性費用,對於小型專案或個人開發者來說,這是一個負擔得起的選擇。 2.專業版:價格為$1,199 ,此選項最多支援 10 位開發人員、10 個地點和 10 個專案。 此等級還包含一次性費用,並為中小型團隊提供更大的靈活性。 3.無限制:對於$2,399 ,此等級允許無限制的開發人員、地點和專案。 對於需要廣泛使用而不受限制的大型團隊和企業來說,這是理想之選。

IronPDF 也為大型組織和需要將 PDF 功能整合到商業產品中的組織提供企業和 OEM 再分發授權。 它還提供免費試用版供用戶測試。

API模板 定價和許可

APITemplate提供了一種不同的方法,即基於 API 的 PDF 生成服務。其定價通常基於 API 呼叫次數,因此可以更靈活地適應不同的使用模式:

1.基本方案:通常價格較低,但每月 API 呼叫次數有限。 這適用於小型專案或對PDF生成需求極少的企業。 2.標準方案:此方案包含更多 API 呼叫和附加功能,適合中型企業。 3.企業計劃:專為高容量用戶量身定制,此計劃提供最多的 API 呼叫和高級功能,如優先支援和自訂整合。

APITemplate 的授權方式很簡單,通常採用每月或按年訂閱的模式。

主要區別

1.定價模式: IronPDF 採用一次性收費模式,從長遠來看,這種模式具有成本效益,尤其適用於持續、大量使用的情況。 另一方面,APITemplate 採用基於訂閱的模型,這種模型在使用上更加靈活和可擴展。 2.支援和更新: IronPDF 包含一年的支援和更新,並可選擇延長此期限。 APITemplate 的訂閱計畫通常包含持續的支援和更新服務。

為什麼選擇 IronPDF?

IronPDF 和 APITemplate 都能夠從 HTML 內容產生 PDF,但 IronPDF 的實作更加強大和靈活。 以下是對比:

IronPDF

using IronPdf;

var renderer = new ChromePdfRenderer();
var html = @"
<html>
<head>
    <style>
        body { font-family: Arial, sans-serif; }
        .header { color: #0066cc; font-size: 24px; }
        .content { margin-top: 20px; }
    </style>
</head>
<body>
    <div class='header'>Dynamic Report</div>
    <div class='content'>
        <p>This report was generated on: <script>document.write(new Date().toLocaleString());</script></p>
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
    </div>
</body>
</html>";
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs("IronPDF_report.pdf");
using IronPdf;

var renderer = new ChromePdfRenderer();
var html = @"
<html>
<head>
    <style>
        body { font-family: Arial, sans-serif; }
        .header { color: #0066cc; font-size: 24px; }
        .content { margin-top: 20px; }
    </style>
</head>
<body>
    <div class='header'>Dynamic Report</div>
    <div class='content'>
        <p>This report was generated on: <script>document.write(new Date().toLocaleString());</script></p>
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
    </div>
</body>
</html>";
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs("IronPDF_report.pdf");
$vbLabelText   $csharpLabel

API模板

using System.Net.Http;
using System.Text.Json;

var apiKey = "your_api_key";
var templateId = "your_template_id";
var url = $"https://rest.apitemplate.io/v2/create-pdf?template_id={templateId}";
var data = new
{
    header = "Dynamic Report",
    content = "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
    date = DateTime.Now.ToShortDateString()
};
var json = JsonSerializer.Serialize(data);
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-KEY", apiKey);
var response = await client.PostAsync(url, content);
var pdfBytes = await response.Content.ReadAsByteArrayAsync();
File.WriteAllBytes("APITemplate_report.pdf", pdfBytes);
using System.Net.Http;
using System.Text.Json;

var apiKey = "your_api_key";
var templateId = "your_template_id";
var url = $"https://rest.apitemplate.io/v2/create-pdf?template_id={templateId}";
var data = new
{
    header = "Dynamic Report",
    content = "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
    date = DateTime.Now.ToShortDateString()
};
var json = JsonSerializer.Serialize(data);
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-KEY", apiKey);
var response = await client.PostAsync(url, content);
var pdfBytes = await response.Content.ReadAsByteArrayAsync();
File.WriteAllBytes("APITemplate_report.pdf", pdfBytes);
$vbLabelText   $csharpLabel

主要區別

  1. JavaScript 支援: IronPDF 完全支援在 HTML 中執行 JavaScript,從而可以動態生成內容(例如範例中的當前日期)。 APITemplate通常要求預先提供所有資料。
  2. CSS 彈性:使用 IronPDF,您可以直接在 HTML 中完全控制 CSS 樣式。 APITemplate 通常需要預先定義的模板,自訂選項有限。 3.效能: IronPDF 在本地處理 HTML,從而加快 PDF 生成速度,尤其對於複雜文件而言。 APITemplate 的雲端方案可能會引入延遲。 4.離線功能: IronPDF 支援離線工作,這對於網路連線受限或安全要求高的應用情境非常有用。 APITemplate始終需要網路連線。 5.動態內容: IronPDF 允許即時產生更動態的內容,而 APITemplate 通常需要預先定義的範本結構。 6.自訂: IronPDF 提供對 PDF 產生過程更精細的控制,包括頁面大小、邊距和其他 PDF 特定設定的選項。 7.一致性: IronPDF 使用其自身的渲染引擎,確保在不同環境下呈現一致的渲染效果。而 APITemplate 的輸出可能因其伺服器配置而異。

結論

在各種 C# 專案中廣泛使用 IronPDF 和 APITemplate 之後,我逐漸體會到每種工具的獨特優勢。 然而,就我處理的大部分 PDF 相關任務而言,IronPDF 始終是更優的選擇。雖然 APITemplate 也有其優勢,尤其是在產生簡單的、基於範本的文件方面,但我發現 IronPDF 的多功能性使其能夠同樣有效地完成這些任務,同時還能在需要時處理更複雜的 PDF 操作。

總而言之,雖然這兩個工具各有用途,但 IronPDF 始終被證明是 C# 開發中處理 PDF 更強大、更靈活、更經濟高效的解決方案。 它強大的功能集、卓越的性能和全面的支持,使它成為我處理任何 PDF 相關任務的首選,從最簡單的文件生成到最複雜的 PDF 操作。

請注意APITemplate 是其各自所有者的註冊商標。 本網站與 APITemplate 無任何關聯,亦未獲得其認可或贊助。 所有產品名稱、標誌和品牌均為其各自所有者的財產。 文中比較僅供參考,反映的是撰寫本文時可公開取得的資訊。

常見問題解答

基於雲端的 PDF 生成工具和基於庫的 PDF 生成工具的主要區別是什麼?

雲端工具(例如 APITemplate)透過 API 呼叫產生 PDF 文件,但需要網路連線。相較之下,基於庫的工具(例如 IronPDF)整合在 C# 應用程式中,支援離線 PDF 操作,並提供對 PDF 建立和自訂的更多控制。

IronPDF 如何處理 C# 應用程式中的 HTML 到 PDF 的轉換?

IronPDF 支援使用RenderHtmlAsPdf等方法將 HTML 無縫轉換為 PDF。它完全支援現代 Web 標準,包括 CSS 和 JavaScript,確保將 Web 內容高品質渲染成 PDF。

我可以使用 IronPDF 在 PDF 中產生動態內容嗎?

是的,IronPDF 支援 JavaScript 執行,這使得在 PDF 中產生動態內容成為可能。這對於直接從包含動態資料的網頁建立互動式 PDF 尤其有用。

與訂閱式服務相比,使用 IronPDF 有哪些優勢?

IronPDF 提供一次性許可費用,為長期使用提供了一種經濟高效的解決方案。它支援離線操作,並提供豐富的 PDF 處理功能,與 APITemplate 等訂閱式服務相比,更加靈活和穩定。

IronPDF 為開發者提供哪些支援?

IronPDF 提供全面的支持,包括詳盡的文檔,例如指南、API 參考和程式碼範例。開發者還可以透過電子郵件支援、社群論壇以及 Stack Overflow 等平台上的監控來尋求協助。

IronPDF是否支援跨平台開發?

是的,IronPDF 與 .NET Standard 相容,支援跨平台開發。這確保開發人員可以將 IronPDF 無縫整合到運行於不同作業系統上的專案中。

IronPDF 如何確保產生的 PDF 檔案的安全性?

IronPDF 包含 PDF 加密和解密功能,讓開發人員可以使用密碼和數位簽章保護文件。這些功能有助於維護 PDF 文件的機密性和完整性。

使用 IronPDF 時有哪些常見的故障排除技巧?

遇到 IronPDF 問題時,請確保所有相依性均已正確安裝和更新。請查閱文件以了解相容性和配置設置,並查看範例程式碼以驗證實作方式。如果問題仍然存在,請聯絡我們的支援團隊尋求協助。

柯蒂斯·週
技術撰稿人

Curtis Chau擁有卡爾頓大學電腦科學學士學位,專長於前端開發,精通Node.js、TypeScript、JavaScript和React。他熱衷於打造直覺美觀的使用者介面,喜歡使用現代框架,並擅長撰寫結構清晰、視覺效果出色的使用者手冊。

除了開發工作之外,柯蒂斯對物聯網 (IoT) 也抱有濃厚的興趣,致力於探索硬體和軟體整合的創新方法。閒暇時,他喜歡玩遊戲和製作 Discord 機器人,將他對科技的熱愛與創造力結合。