跳過到頁腳內容
產品比較

IronPDF vs GrapeCity PDF:.NET PDF 程式庫比較

IronPDF 專注於使用 Chrome V8 渲染引擎為 .NET 應用程式產生 HTML 到 PDF,而 GrapeCity PDF 則專注於 PDF 檢視和註解功能,因此 IronPDF 是需要具備完整 PDF 建立功能和現代 Web 內容支援的開發人員的更佳選擇。

PDF 代表可攜式文件格式。 它是一種允許在多種不同設備上以常規方式查看文件的文件類型。 PDF 通常用於與潛在雇主分享履歷表或與客戶分享發票等重要文件。

儘管PDF格式很受歡迎,但它也存在一些限制。 例如,您無法透過電子郵件分享 PDF 文件,收件者需要 PDF 閱讀器才能開啟。 PDF檔案在行動裝置上的顯示效果可能不如Word文件清晰。 此外,與 Word 文件不同,PDF 需要編輯軟體才能修改或更新內容。 但是,PDF 文件在所有裝置上(無論是 PC 還是 Mac)都能保持一致的外觀。 這種可靠性使得 PDF 成為一種標準格式,而其他文件類型(如 JPEG 或 GIF)則不具備這種可靠性。

在這篇文章中,我們將回顧兩個 .NET PDF 函式庫:

  • IronPDF
  • GrapeCity PDF

IronPDF是什麼?它與GrapeCity相比如何?

IronPDF是一個 .NET 程式庫,它提供用於建立、讀取和操作 PDF 文件的功能,且程式碼量極少。 本文示範如何使用 IronPDF 建立 PDF 文件。 你需要對 Visual Studio 或 C# 有基本的了解,並具備 HTML 的工作知識。

您需要 Visual Studio 來編寫、編譯和運行應用程序,C# 來編寫邏輯和程式碼,以及 HTML 來格式化 PDF 文件,包括標題、副標題、圖像和段落。 IronPDF 完全支援.NET Core 、.NET 5、.NET Framework 和 .NET Standard。 對於ASP.NET 應用程序,IronPDF 提供將網頁轉換為 PDF 的流暢整合。

只要具備基本的 C# 和 HTML 知識,就可以用最少的程式碼在 C# 中建立 PDF 檔案。 請造訪IronPDF 官方功能頁面以了解更多資訊。 對於程式化 PDF 創建,IronPDF 提供了除基本 HTML 轉換之外的廣泛功能。

如何在我的.NET專案中安裝IronPDF?

開發解決方案需要安裝IronPDF NuGet 套件。 從選單列點選"項目"。 從下拉式選單中選擇"管理NuGet 套件"。 有關詳細說明,請參閱安裝概述。 此視窗將顯示:

NuGet Package Manager window in Visual Studio showing no search results for IronPdf package

在 NuGet 套件管理器介面搜尋 IronPdf 時顯示空搜尋結果,表示該套件可能無法使用或有連線問題。

選擇"瀏覽"即可查看此視窗:

NuGet Package Manager interface in Visual Studio showing popular .NET packages including Entity Framework Core, Newtonsoft.Json, and Microsoft.Extensions.`DependencyInjection` with their version numbers and download counts.

NuGet 套件管理器可以輕鬆存取必要的 .NET 程式庫,其中 Entity Framework Core 和 Newtonsoft.Json 分別是資料庫操作和 JSON 處理中最受歡迎的套件之一。

在搜尋框中輸入"IronPdf",然後按下"回車"鍵。有關進階安裝選項(包括特定於平台的配置),請查閱文件。 你應該看看:

NuGet Package Manager showing search results for IronPDF packages, including the main IronPDF library with 1.87M downloads and related rendering assets packages.

NuGet 套件管理器介面顯示可供安裝的各種 IronPDF 包,每個包都會顯示下載次數和版本號碼。

選擇 IronPDF:

NuGet Package Manager showing IronPDF installation options alongside competing PDF libraries including PDFCore and other IronPDF rendering packages

NuGet 套件管理器介面顯示 IronPDF(版本 2021.3.1)為選定的安裝程式包,並列出了其他 PDF 庫以供比較,包括 PDFCore 和各種 IronPDF 渲染資源。

點選"安裝"。 安裝成功後,您將看到:

Visual Studio dialog showing IronPDF package installation with dependencies including IronPdf.2021.3.1 and related packages.

Visual Studio 中的 IronPDF 安裝過程,展示了 NuGet 套件管理器如何安裝 IronPDF 版本 2021.3.1 及其相依性。

按"確定"完成安裝。 IronPDF 支援Windows 平台,包括 Windows 10、11 和伺服器版本。 該庫還支援LinuxmacOS ,可用於跨平台開發。

如何使用 IronPDF 建立 PDF 文件?

在檔案頂部新增 IronPdf 命名空間。 VB.NET開發人員也可以使用類似的功能:

using IronPdf;
using IronPdf;
Imports IronPdf
$vbLabelText   $csharpLabel

您需要指定檔案路徑來儲存生成的PDF檔案。 使用 SaveFileDialog 提示使用者輸入檔案名稱和路徑。 對於進階應用場景,可將 PDF 檔案匯出到記憶體流而不儲存到磁碟:

private void Save_Click(object sender, EventArgs e)
{
    // Code to Select the folder and save the file.
    SaveFileDialog saveFileDialog1 = new SaveFileDialog();
    saveFileDialog1.InitialDirectory = @"D:\";
    saveFileDialog1.Title = "Save Pdf File";
    saveFileDialog1.DefaultExt = "pdf";
    saveFileDialog1.Filter = "Pdf files (*.pdf)|*.pdf|All files (*.*)|*.*";
    saveFileDialog1.FilterIndex = 2;
    saveFileDialog1.RestoreDirectory = true;
    if (saveFileDialog1.ShowDialog() == DialogResult.OK)
    {
        string filename = saveFileDialog1.FileName;
        // actual code that will create Pdf files
        var HtmlLine = new HtmlToPdf();
        HtmlLine.RenderHtmlAsPdf(PdfText.Text).SaveAs(filename);
        // MessageBox to display that file save
        MessageBox.Show("File Saved Successfully!");
    }
}
private void Save_Click(object sender, EventArgs e)
{
    // Code to Select the folder and save the file.
    SaveFileDialog saveFileDialog1 = new SaveFileDialog();
    saveFileDialog1.InitialDirectory = @"D:\";
    saveFileDialog1.Title = "Save Pdf File";
    saveFileDialog1.DefaultExt = "pdf";
    saveFileDialog1.Filter = "Pdf files (*.pdf)|*.pdf|All files (*.*)|*.*";
    saveFileDialog1.FilterIndex = 2;
    saveFileDialog1.RestoreDirectory = true;
    if (saveFileDialog1.ShowDialog() == DialogResult.OK)
    {
        string filename = saveFileDialog1.FileName;
        // actual code that will create Pdf files
        var HtmlLine = new HtmlToPdf();
        HtmlLine.RenderHtmlAsPdf(PdfText.Text).SaveAs(filename);
        // MessageBox to display that file save
        MessageBox.Show("File Saved Successfully!");
    }
}
Private Sub Save_Click(ByVal sender As Object, ByVal e As EventArgs)
	' Code to Select the folder and save the file.
	Dim saveFileDialog1 As New SaveFileDialog()
	saveFileDialog1.InitialDirectory = "D:\"
	saveFileDialog1.Title = "Save Pdf File"
	saveFileDialog1.DefaultExt = "pdf"
	saveFileDialog1.Filter = "Pdf files (*.pdf)|*.pdf|All files (*.*)|*.*"
	saveFileDialog1.FilterIndex = 2
	saveFileDialog1.RestoreDirectory = True
	If saveFileDialog1.ShowDialog() = DialogResult.OK Then
		Dim filename As String = saveFileDialog1.FileName
		' actual code that will create Pdf files
		Dim HtmlLine = New HtmlToPdf()
		HtmlLine.RenderHtmlAsPdf(PdfText.Text).SaveAs(filename)
		' MessageBox to display that file save
		MessageBox.Show("File Saved Successfully!")
	End If
End Sub
$vbLabelText   $csharpLabel

SaveFileDialog 開啟一個對話框,用於選擇資料夾和檔案名稱。 初始目錄預設為D盤,但您可以更改它。 DefaultExtension 設定為 PDF。 如需了解完整的轉換選項,請參閱HTML 轉 PDF 教學

"if"條件語句包含建立PDF的程式碼。 只需兩行程式碼即可產生 PDF 檔案。 PdfText 是包含 PDF 內容的富文本框名稱。 檔案名稱是從 SaveFileDialog 中選擇的檔案路徑。 對於 Web 應用程序,IronPDF 支援URL 到 PDF 的轉換ASPX 到 PDF 的轉換

如何使用 IronPDF 閱讀 PDF 文件?

使用 IronPDF 讀取 PDF 檔案只需要兩行程式碼。 如需了解進階擷取功能,請參閱擷取文字和圖像指南

新增以下導入語句:

using IronPdf;
using System;
using System.Windows.Forms;
using IronPdf;
using System;
using System.Windows.Forms;
Imports IronPdf
Imports System
Imports System.Windows.Forms
$vbLabelText   $csharpLabel

請將此程式碼寫在您的函數內部。 IronPDF 提供PDF 解析功能PDF DOM 存取

private void Read_Click(object sender, EventArgs e)
{
    PdfDocument PDF = PdfDocument.FromFile(FilePath.Text);
    FileContent.Text = PDF.ExtractAllText();
}
private void Read_Click(object sender, EventArgs e)
{
    PdfDocument PDF = PdfDocument.FromFile(FilePath.Text);
    FileContent.Text = PDF.ExtractAllText();
}
Private Sub Read_Click(ByVal sender As Object, ByVal e As EventArgs)
	Dim PDF As PdfDocument = PdfDocument.FromFile(FilePath.Text)
	FileContent.Text = PDF.ExtractAllText()
End Sub
$vbLabelText   $csharpLabel

此功能可將文件中的所有資訊提取出來並傳送給檢視者。 報表元件使用此資料作為資料來源。 IronPDF 支援從記憶體流讀取 PDF 文件,並將PDF 文件轉換為 HTML以便在網頁上顯示。

GrapeCity PDF 提供哪些功能?

GrapeCity Documents 提供跨平台的通用格式文件管理。 .NET Standard 2.0 函式庫無需 Adobe Acrobat 即可讀取、產生、修改和儲存 PDF 檔案。 它提供字體支援、圖像、圖形、條碼、註釋、輪廓、圖章和浮水印。

有哪些PDF處理功能?

GrapeCityPDF 為 .NET Standard 應用程式中的基本或複雜業務需求建立 PDF 檔案。您可以從任何來源載入、變更和儲存 PDF 檔案。 IronPDF 提供完整的PDF 編輯功能,包括合併/分割 PDF新增/刪除頁面旋轉頁面

我可以將PDF檔案轉換為圖像嗎?

GrapeCityPDF 使用最少的程式碼將 PDF 儲存為影像,而不會造成品質損失。 IronPDF 提供將 PDF 柵格化為影像的功能,支援 PNG、JPEG 和 TIFF 格式。

GrapeCity 是否包含 PDF 檢視器元件?

GrapeCity Documents PDF Viewer 是一款輕量級的用戶端檢視器,支援標準 PDF 功能。 對於 .NET MAUI 開發人員來說,IronPDF 提供在 MAUI 應用程式中查看 PDF 的功能,包括導航和搜尋功能。

支援哪些類型的功能?

GrapeCityPDF 建立包含文字、圖形、照片、註解和輪廓的複雜 PDF。 IronPDF 也擴展了這些功能,包括數位簽章表單建立/填寫浮水印元資料管理

如何安裝 GrapeCity PDF?

IronPDF 提供兩種安裝方式。對於容器化部署,IronPDF支援 Docker遠端容器操作,以實現靈活的生成:

  1. 下載壓縮後的來源檔。
  2. 將檔案解壓縮到目錄。
  3. 進入該目錄。
  4. 執行 run.cmd 來建置範例,啟動 SupportApi 服務,並開啟 http://localhost:3003
  5. 詳情請參閱 readme.MD

如何安裝 WinForms 版本?

請依照以下步驟安裝 WinForms 版本:

  • Download C1ControlPanel from GrapeCity's ComponentOne.
  • 使用 ComponentOneC1ControlPanel.exe 開啟 ControlPanel(關閉 Visual Studio)。
  • 使用註冊郵箱/密碼登入。
  • 對於新用戶:
    • 註冊並建立帳戶。
    • 驗證電子郵件地址。
    • 透過驗證連結啟動。
    • 若願意,可以匿名使用。
  • 選擇"在 WinForms 版本中安裝"。選取"所有版本"複選框即可安裝所有版本。
`ComponentOne` product edition comparison showing six different editions including `WinForms`, WPF, MVC, MVC Core, Wijmo, and UWP editions with their descriptions and install options

`GrapeCity`'s `ComponentOne` offers multiple edition options tailored to different development platforms and frameworks, each with the option to install sample projects

  • 點選"安裝"查看授權協議。 審核後接受。
  • 接受許可協議以查看設定頁面。 驗證目錄路徑並開始安裝。
`ComponentOne` installation settings screen showing installation directory, samples directory, and options to join customer experience program and send system information

`ComponentOne` installation configuration screen with privacy and data collection options

  • 安裝程式會在控制器安裝過程中顯示進度。 在此過程中無法取消。
  • 安裝完成後,將顯示"安裝成功"畫面。 顯示目前已安裝的版本。
`WinForms` Edition installation dialog showing download progress and install button for 65+ UI controls

The `WinForms` Edition installer interface displays a simple download progress bar and installation option for a suite of 65+ smart and effective UI controls designed for rapid Windows Forms development.

`ComponentOne` installation success screen showing version 20183.1.338 with View Log and Back buttons

The `ComponentOne` installation interface displays a successful installation message for version 20183.1.338, featuring navigation tabs for Products, Activities, License, and Support

如何使用 GrapeCity 建立 PDF?

以下程式碼示範了基本的 GrapeCity PDF 建立。 對於HTML 轉 PDF(使用 JavaScript)響應式 CSS自訂頁首/頁尾等進階功能,IronPDF 提供完整的解決方案:

using System;
using System.IO;
using System.Drawing;
using System.Text;
using GrapeCity.Documents.Text;
using GrapeCity.Documents.Common;
using GrapeCity.Documents.Drawing;
using GrapeCity.Documents.Pdf;
using GrapeCity.Documents.Pdf.Structure;
using GrapeCity.Documents.Pdf.MarkedContent;
using GrapeCity.Documents.Pdf.Graphics;
using GrapeCity.Documents.Pdf.Annotations;
using GCTEXT = GrapeCity.Documents.Text;
using GCDRAW = GrapeCity.Documents.Drawing;
namespace GcPdfWeb.Samples.Basics
{
    // This sample shows how to create a PDF/A-3u compliant document.
    public class PdfA
    {
        public void CreatePDF(Stream stream)
        {
            var doc = new GcPdfDocument();
            var date = new DateTime(1961, 4, 12, 6, 7, 0, DateTimeKind.Utc);

            // Mark the document as PDF/A-3u conformant:
            doc.ConformanceLevel = PdfAConformanceLevel.PdfA3u;

            var fnt = GCTEXT.Font.FromFile(Path.Combine("Resources", "Fonts", "arial.ttf"));
            var gap = 36;

            // PDF/A-3a requires all content to be tagged so create and populate StructElement when rendering:
            StructElement sePart = new StructElement("Part");
            doc.StructTreeRoot.Children.Add(sePart);

            TextLayout tl = null;
            // Add 3 pages with sample content tagged according to PDF/A rules:
            for (int pageNo = 1; pageNo <= 3; ++pageNo)
            {
                // add page
                var page = doc.Pages.Add();
                var g = page.Graphics;
                float y = 72;
                if (doc.Pages.Count == 1)
                {
                    // Create paragraph element:
                    var seParagraph = new StructElement("P") { DefaultPage = page };
                    // Add it to Part element:
                    sePart.Children.Add(seParagraph);

                    tl = g.CreateTextLayout();
                    tl.MarginAll = 72;
                    tl.MaxWidth = page.Size.Width;

                    tl.DefaultFormat.Font = fnt;
                    tl.DefaultFormat.FontBold = true;
                    tl.DefaultFormat.FontSize = 20;
                    tl.Append("PDF/A-3A Document");

                    // PerformLayout is done automatically in a new TextLayout or after a Clear():
                    //tl.PerformLayout(true);

                    // Draw TextLayout within tagged content:
                    g.BeginMarkedContent(new TagMcid("P", 0));
                    g.DrawTextLayout(tl, PointF.Empty);
                    g.EndMarkedContent();

                    y = tl.ContentRectangle.Bottom + gap;

                    seParagraph.ContentItems.Add(new McidContentItemLink(0));
                }

                // Add some sample paragraphs tagged according to PDF/A rules:
                for (int i = 1; i <= 3; ++i)
                {
                    // Create paragraph element:
                    var seParagraph = new StructElement("P") { DefaultPage = page };
                    // Add it to Part element:
                    sePart.Children.Add(seParagraph);

                    var sb = new StringBuilder();
                    sb.Append(string.Format("Paragraph {0} on page {1}: ", i, pageNo));
                    sb.Append(Common.Util.LoremIpsum(1, 2, 4, 5, 10));
                    var para = sb.ToString();

                    tl.Clear();
                    tl.DefaultFormat.FontSize = 14;
                    tl.DefaultFormat.FontBold = false;
                    tl.MarginTop = y;
                    tl.Append(para);

                    // Draw TextLayout within tagged content:
                    g.BeginMarkedContent(new TagMcid("P", i));
                    g.DrawTextLayout(tl, PointF.Empty);
                    g.EndMarkedContent();

                    y += tl.ContentHeight + gap;

                    // Add content item to paragraph StructElement:
                    seParagraph.ContentItems.Add(new McidContentItemLink(i));

                    // PDF/A-3 allows embedding files into document, but they should be associated with some document element
                    // add embedded file associated with seParagraph:
                    var ef1 = EmbeddedFileStream.FromBytes(doc, Encoding.UTF8.GetBytes(para));
                    // ModificationDate and MimeType should be specified in case of PDF/A:
                    ef1.ModificationDate = date;
                    ef1.MimeType = "text/plain";
                    var fn = string.Format("Page{0}_Paragraph{1}.txt", pageNo, i);
                    var fs1 = FileSpecification.FromEmbeddedStream(fn, ef1);
                    // UnicodeFile.FileName should be specified for PDF/A compliance:
                    fs1.UnicodeFile.FileName = fs1.File.FileName;
                    // Relationship should be specified in case of PDF/A:
                    fs1.Relationship = AFRelationship.Unspecified;
                    doc.EmbeddedFiles.Add(fn, fs1);
                    seParagraph.AssociatedFiles.Add(fs1);
                }
            }

            // PDF/A-3 allows transparency drawing in PDF file, add some:
            var gpage = doc.Pages [0].Graphics;
            gpage.FillRectangle(new RectangleF(20, 20, 200, 200), Color.FromArgb(40, Color.Red));

            // PDF/A-3 allows using FormXObjects, add one with transparency:
            var r = new RectangleF(0, 0, 144, 72);
            var fxo = new FormXObject(doc, r);
            var gfxo = fxo.Graphics;
            gfxo.FillRectangle(r, Color.FromArgb(40, Color.Violet));
            TextFormat tf = new TextFormat()
            {
                Font = fnt,
                FontSize = 16,
                ForeColor = Color.FromArgb(100, Color.Black),
            };
            gfxo.DrawString("FormXObject", tf, r, TextAlignment.Center, ParagraphAlignment.Center);
            gfxo.DrawRectangle(r, Color.Blue, 3);
            gpage.DrawForm(fxo, new RectangleF(300, 250, r.Width, r.Height), null, ImageAlign.ScaleImage);

            // PDF/A-3 allows using embedded files, but each embedded file must be associated with a document's element:
            EmbeddedFileStream ef = EmbeddedFileStream.FromFile(doc, Path.Combine("Resources", "WordDocs", "ProcurementLetter.docx"));
            // ModificationDate and MimeType should be specified for EmbeddedFile in PDF/A:
            ef.ModificationDate = date;
            ef.MimeType = "application/msword";
            var fs = FileSpecification.FromEmbeddedFile(ef);
            fs.UnicodeFile.FileName = fs.File.FileName;
            fs.Relationship = AFRelationship.Unspecified;
            doc.EmbeddedFiles.Add("ProcurementLetter.docx", fs);
            // Associate embedded file with the document:
            doc.AssociatedFiles.Add(fs);

            // Add an attachment associated with an annotation:
            var sa = new StampAnnotation()
            {
                UserName = "Minerva",
                Font = fnt,
                Rect = new RectangleF(300, 36, 220, 72),
            };
            sa.Flags |= AnnotationFlags.Print;
            // Use a FormXObject to represent the stamp annotation:
            var stampFxo = new FormXObject(doc, new RectangleF(PointF.Empty, sa.Rect.Size));
            var gstampFxo = stampFxo.Graphics;
            gstampFxo.FillRectangle(stampFxo.Bounds, Color.FromArgb(40, Color.Green));
            gstampFxo.DrawString("Stamp Annotation\nassociated with minerva.jpg", tf, stampFxo.Bounds, TextAlignment.Center, ParagraphAlignment.Center);
            gstampFxo.DrawRectangle(stampFxo.Bounds, Color.Green, 3);
            //
            sa.AppearanceStreams.Normal.Default = stampFxo;
            doc.Pages [0].Annotations.Add(sa);
            ef = EmbeddedFileStream.FromFile(doc, Path.Combine("Resources", "Images", "minerva.jpg"));
            ef.ModificationDate = date;
            ef.MimeType = "image/jpeg";
            fs = FileSpecification.FromEmbeddedFile(ef);
            fs.UnicodeFile.FileName = fs.File.FileName;
            fs.Relationship = AFRelationship.Unspecified;
            doc.EmbeddedFiles.Add("minerva.jpg", fs);
            sa.AssociatedFiles.Add(fs);

            // Mark the document as conforming to Tagged PDF conventions (required for PDF/A):
            doc.MarkInfo.Marked = true;

            // Metadata.CreatorTool and DocumentInfo.Creator should be the same for a PDF/A document:
            doc.Metadata.CreatorTool = doc.DocumentInfo.Creator;
            // A title should be specified for PDF/A document:
            doc.Metadata.Title = "GcPdf Document";
            doc.ViewerPreferences.DisplayDocTitle = true;

            // Done:
            doc.Save(stream);
        }
    }
}
using System;
using System.IO;
using System.Drawing;
using System.Text;
using GrapeCity.Documents.Text;
using GrapeCity.Documents.Common;
using GrapeCity.Documents.Drawing;
using GrapeCity.Documents.Pdf;
using GrapeCity.Documents.Pdf.Structure;
using GrapeCity.Documents.Pdf.MarkedContent;
using GrapeCity.Documents.Pdf.Graphics;
using GrapeCity.Documents.Pdf.Annotations;
using GCTEXT = GrapeCity.Documents.Text;
using GCDRAW = GrapeCity.Documents.Drawing;
namespace GcPdfWeb.Samples.Basics
{
    // This sample shows how to create a PDF/A-3u compliant document.
    public class PdfA
    {
        public void CreatePDF(Stream stream)
        {
            var doc = new GcPdfDocument();
            var date = new DateTime(1961, 4, 12, 6, 7, 0, DateTimeKind.Utc);

            // Mark the document as PDF/A-3u conformant:
            doc.ConformanceLevel = PdfAConformanceLevel.PdfA3u;

            var fnt = GCTEXT.Font.FromFile(Path.Combine("Resources", "Fonts", "arial.ttf"));
            var gap = 36;

            // PDF/A-3a requires all content to be tagged so create and populate StructElement when rendering:
            StructElement sePart = new StructElement("Part");
            doc.StructTreeRoot.Children.Add(sePart);

            TextLayout tl = null;
            // Add 3 pages with sample content tagged according to PDF/A rules:
            for (int pageNo = 1; pageNo <= 3; ++pageNo)
            {
                // add page
                var page = doc.Pages.Add();
                var g = page.Graphics;
                float y = 72;
                if (doc.Pages.Count == 1)
                {
                    // Create paragraph element:
                    var seParagraph = new StructElement("P") { DefaultPage = page };
                    // Add it to Part element:
                    sePart.Children.Add(seParagraph);

                    tl = g.CreateTextLayout();
                    tl.MarginAll = 72;
                    tl.MaxWidth = page.Size.Width;

                    tl.DefaultFormat.Font = fnt;
                    tl.DefaultFormat.FontBold = true;
                    tl.DefaultFormat.FontSize = 20;
                    tl.Append("PDF/A-3A Document");

                    // PerformLayout is done automatically in a new TextLayout or after a Clear():
                    //tl.PerformLayout(true);

                    // Draw TextLayout within tagged content:
                    g.BeginMarkedContent(new TagMcid("P", 0));
                    g.DrawTextLayout(tl, PointF.Empty);
                    g.EndMarkedContent();

                    y = tl.ContentRectangle.Bottom + gap;

                    seParagraph.ContentItems.Add(new McidContentItemLink(0));
                }

                // Add some sample paragraphs tagged according to PDF/A rules:
                for (int i = 1; i <= 3; ++i)
                {
                    // Create paragraph element:
                    var seParagraph = new StructElement("P") { DefaultPage = page };
                    // Add it to Part element:
                    sePart.Children.Add(seParagraph);

                    var sb = new StringBuilder();
                    sb.Append(string.Format("Paragraph {0} on page {1}: ", i, pageNo));
                    sb.Append(Common.Util.LoremIpsum(1, 2, 4, 5, 10));
                    var para = sb.ToString();

                    tl.Clear();
                    tl.DefaultFormat.FontSize = 14;
                    tl.DefaultFormat.FontBold = false;
                    tl.MarginTop = y;
                    tl.Append(para);

                    // Draw TextLayout within tagged content:
                    g.BeginMarkedContent(new TagMcid("P", i));
                    g.DrawTextLayout(tl, PointF.Empty);
                    g.EndMarkedContent();

                    y += tl.ContentHeight + gap;

                    // Add content item to paragraph StructElement:
                    seParagraph.ContentItems.Add(new McidContentItemLink(i));

                    // PDF/A-3 allows embedding files into document, but they should be associated with some document element
                    // add embedded file associated with seParagraph:
                    var ef1 = EmbeddedFileStream.FromBytes(doc, Encoding.UTF8.GetBytes(para));
                    // ModificationDate and MimeType should be specified in case of PDF/A:
                    ef1.ModificationDate = date;
                    ef1.MimeType = "text/plain";
                    var fn = string.Format("Page{0}_Paragraph{1}.txt", pageNo, i);
                    var fs1 = FileSpecification.FromEmbeddedStream(fn, ef1);
                    // UnicodeFile.FileName should be specified for PDF/A compliance:
                    fs1.UnicodeFile.FileName = fs1.File.FileName;
                    // Relationship should be specified in case of PDF/A:
                    fs1.Relationship = AFRelationship.Unspecified;
                    doc.EmbeddedFiles.Add(fn, fs1);
                    seParagraph.AssociatedFiles.Add(fs1);
                }
            }

            // PDF/A-3 allows transparency drawing in PDF file, add some:
            var gpage = doc.Pages [0].Graphics;
            gpage.FillRectangle(new RectangleF(20, 20, 200, 200), Color.FromArgb(40, Color.Red));

            // PDF/A-3 allows using FormXObjects, add one with transparency:
            var r = new RectangleF(0, 0, 144, 72);
            var fxo = new FormXObject(doc, r);
            var gfxo = fxo.Graphics;
            gfxo.FillRectangle(r, Color.FromArgb(40, Color.Violet));
            TextFormat tf = new TextFormat()
            {
                Font = fnt,
                FontSize = 16,
                ForeColor = Color.FromArgb(100, Color.Black),
            };
            gfxo.DrawString("FormXObject", tf, r, TextAlignment.Center, ParagraphAlignment.Center);
            gfxo.DrawRectangle(r, Color.Blue, 3);
            gpage.DrawForm(fxo, new RectangleF(300, 250, r.Width, r.Height), null, ImageAlign.ScaleImage);

            // PDF/A-3 allows using embedded files, but each embedded file must be associated with a document's element:
            EmbeddedFileStream ef = EmbeddedFileStream.FromFile(doc, Path.Combine("Resources", "WordDocs", "ProcurementLetter.docx"));
            // ModificationDate and MimeType should be specified for EmbeddedFile in PDF/A:
            ef.ModificationDate = date;
            ef.MimeType = "application/msword";
            var fs = FileSpecification.FromEmbeddedFile(ef);
            fs.UnicodeFile.FileName = fs.File.FileName;
            fs.Relationship = AFRelationship.Unspecified;
            doc.EmbeddedFiles.Add("ProcurementLetter.docx", fs);
            // Associate embedded file with the document:
            doc.AssociatedFiles.Add(fs);

            // Add an attachment associated with an annotation:
            var sa = new StampAnnotation()
            {
                UserName = "Minerva",
                Font = fnt,
                Rect = new RectangleF(300, 36, 220, 72),
            };
            sa.Flags |= AnnotationFlags.Print;
            // Use a FormXObject to represent the stamp annotation:
            var stampFxo = new FormXObject(doc, new RectangleF(PointF.Empty, sa.Rect.Size));
            var gstampFxo = stampFxo.Graphics;
            gstampFxo.FillRectangle(stampFxo.Bounds, Color.FromArgb(40, Color.Green));
            gstampFxo.DrawString("Stamp Annotation\nassociated with minerva.jpg", tf, stampFxo.Bounds, TextAlignment.Center, ParagraphAlignment.Center);
            gstampFxo.DrawRectangle(stampFxo.Bounds, Color.Green, 3);
            //
            sa.AppearanceStreams.Normal.Default = stampFxo;
            doc.Pages [0].Annotations.Add(sa);
            ef = EmbeddedFileStream.FromFile(doc, Path.Combine("Resources", "Images", "minerva.jpg"));
            ef.ModificationDate = date;
            ef.MimeType = "image/jpeg";
            fs = FileSpecification.FromEmbeddedFile(ef);
            fs.UnicodeFile.FileName = fs.File.FileName;
            fs.Relationship = AFRelationship.Unspecified;
            doc.EmbeddedFiles.Add("minerva.jpg", fs);
            sa.AssociatedFiles.Add(fs);

            // Mark the document as conforming to Tagged PDF conventions (required for PDF/A):
            doc.MarkInfo.Marked = true;

            // Metadata.CreatorTool and DocumentInfo.Creator should be the same for a PDF/A document:
            doc.Metadata.CreatorTool = doc.DocumentInfo.Creator;
            // A title should be specified for PDF/A document:
            doc.Metadata.Title = "GcPdf Document";
            doc.ViewerPreferences.DisplayDocTitle = true;

            // Done:
            doc.Save(stream);
        }
    }
}
Imports Microsoft.VisualBasic
Imports System
Imports System.IO
Imports System.Drawing
Imports System.Text
Imports GrapeCity.Documents.Text
Imports GrapeCity.Documents.Common
Imports GrapeCity.Documents.Drawing
Imports GrapeCity.Documents.Pdf
Imports GrapeCity.Documents.Pdf.Structure
Imports GrapeCity.Documents.Pdf.MarkedContent
Imports GrapeCity.Documents.Pdf.Graphics
Imports GrapeCity.Documents.Pdf.Annotations
Imports GCTEXT = GrapeCity.Documents.Text
Imports GCDRAW = GrapeCity.Documents.Drawing
Namespace GcPdfWeb.Samples.Basics
	' This sample shows how to create a PDF/A-3u compliant document.
	Public Class PdfA
		Public Sub CreatePDF(ByVal stream As Stream)
			Dim doc = New GcPdfDocument()
			Dim [date] = New DateTime(1961, 4, 12, 6, 7, 0, DateTimeKind.Utc)

			' Mark the document as PDF/A-3u conformant:
			doc.ConformanceLevel = PdfAConformanceLevel.PdfA3u

			Dim fnt = GCTEXT.Font.FromFile(Path.Combine("Resources", "Fonts", "arial.ttf"))
			Dim gap = 36

			' PDF/A-3a requires all content to be tagged so create and populate StructElement when rendering:
			Dim sePart As New StructElement("Part")
			doc.StructTreeRoot.Children.Add(sePart)

			Dim tl As TextLayout = Nothing
			' Add 3 pages with sample content tagged according to PDF/A rules:
			For pageNo As Integer = 1 To 3
				' add page
				Dim page = doc.Pages.Add()
				Dim g = page.Graphics
				Dim y As Single = 72
				If doc.Pages.Count = 1 Then
					' Create paragraph element:
					Dim seParagraph = New StructElement("P") With {.DefaultPage = page}
					' Add it to Part element:
					sePart.Children.Add(seParagraph)

					tl = g.CreateTextLayout()
					tl.MarginAll = 72
					tl.MaxWidth = page.Size.Width

					tl.DefaultFormat.Font = fnt
					tl.DefaultFormat.FontBold = True
					tl.DefaultFormat.FontSize = 20
					tl.Append("PDF/A-3A Document")

					' PerformLayout is done automatically in a new TextLayout or after a Clear():
					'tl.PerformLayout(true);

					' Draw TextLayout within tagged content:
					g.BeginMarkedContent(New TagMcid("P", 0))
					g.DrawTextLayout(tl, PointF.Empty)
					g.EndMarkedContent()

					y = tl.ContentRectangle.Bottom + gap

					seParagraph.ContentItems.Add(New McidContentItemLink(0))
				End If

				' Add some sample paragraphs tagged according to PDF/A rules:
				For i As Integer = 1 To 3
					' Create paragraph element:
					Dim seParagraph = New StructElement("P") With {.DefaultPage = page}
					' Add it to Part element:
					sePart.Children.Add(seParagraph)

					Dim sb = New StringBuilder()
					sb.Append(String.Format("Paragraph {0} on page {1}: ", i, pageNo))
					sb.Append(Common.Util.LoremIpsum(1, 2, 4, 5, 10))
					Dim para = sb.ToString()

					tl.Clear()
					tl.DefaultFormat.FontSize = 14
					tl.DefaultFormat.FontBold = False
					tl.MarginTop = y
					tl.Append(para)

					' Draw TextLayout within tagged content:
					g.BeginMarkedContent(New TagMcid("P", i))
					g.DrawTextLayout(tl, PointF.Empty)
					g.EndMarkedContent()

					y += tl.ContentHeight + gap

					' Add content item to paragraph StructElement:
					seParagraph.ContentItems.Add(New McidContentItemLink(i))

					' PDF/A-3 allows embedding files into document, but they should be associated with some document element
					' add embedded file associated with seParagraph:
					Dim ef1 = EmbeddedFileStream.FromBytes(doc, Encoding.UTF8.GetBytes(para))
					' ModificationDate and MimeType should be specified in case of PDF/A:
					ef1.ModificationDate = [date]
					ef1.MimeType = "text/plain"
					Dim fn = String.Format("Page{0}_Paragraph{1}.txt", pageNo, i)
					Dim fs1 = FileSpecification.FromEmbeddedStream(fn, ef1)
					' UnicodeFile.FileName should be specified for PDF/A compliance:
					fs1.UnicodeFile.FileName = fs1.File.FileName
					' Relationship should be specified in case of PDF/A:
					fs1.Relationship = AFRelationship.Unspecified
					doc.EmbeddedFiles.Add(fn, fs1)
					seParagraph.AssociatedFiles.Add(fs1)
				Next i
			Next pageNo

			' PDF/A-3 allows transparency drawing in PDF file, add some:
			Dim gpage = doc.Pages (0).Graphics
			gpage.FillRectangle(New RectangleF(20, 20, 200, 200), Color.FromArgb(40, Color.Red))

			' PDF/A-3 allows using FormXObjects, add one with transparency:
			Dim r = New RectangleF(0, 0, 144, 72)
			Dim fxo = New FormXObject(doc, r)
			Dim gfxo = fxo.Graphics
			gfxo.FillRectangle(r, Color.FromArgb(40, Color.Violet))
			Dim tf As New TextFormat() With {
				.Font = fnt,
				.FontSize = 16,
				.ForeColor = Color.FromArgb(100, Color.Black)
			}
			gfxo.DrawString("FormXObject", tf, r, TextAlignment.Center, ParagraphAlignment.Center)
			gfxo.DrawRectangle(r, Color.Blue, 3)
			gpage.DrawForm(fxo, New RectangleF(300, 250, r.Width, r.Height), Nothing, ImageAlign.ScaleImage)

			' PDF/A-3 allows using embedded files, but each embedded file must be associated with a document's element:
			Dim ef As EmbeddedFileStream = EmbeddedFileStream.FromFile(doc, Path.Combine("Resources", "WordDocs", "ProcurementLetter.docx"))
			' ModificationDate and MimeType should be specified for EmbeddedFile in PDF/A:
			ef.ModificationDate = [date]
			ef.MimeType = "application/msword"
			Dim fs = FileSpecification.FromEmbeddedFile(ef)
			fs.UnicodeFile.FileName = fs.File.FileName
			fs.Relationship = AFRelationship.Unspecified
			doc.EmbeddedFiles.Add("ProcurementLetter.docx", fs)
			' Associate embedded file with the document:
			doc.AssociatedFiles.Add(fs)

			' Add an attachment associated with an annotation:
			Dim sa = New StampAnnotation() With {
				.UserName = "Minerva",
				.Font = fnt,
				.Rect = New RectangleF(300, 36, 220, 72)
			}
			sa.Flags = sa.Flags Or AnnotationFlags.Print
			' Use a FormXObject to represent the stamp annotation:
			Dim stampFxo = New FormXObject(doc, New RectangleF(PointF.Empty, sa.Rect.Size))
			Dim gstampFxo = stampFxo.Graphics
			gstampFxo.FillRectangle(stampFxo.Bounds, Color.FromArgb(40, Color.Green))
			gstampFxo.DrawString("Stamp Annotation" & vbLf & "associated with minerva.jpg", tf, stampFxo.Bounds, TextAlignment.Center, ParagraphAlignment.Center)
			gstampFxo.DrawRectangle(stampFxo.Bounds, Color.Green, 3)
			'
			sa.AppearanceStreams.Normal.Default = stampFxo
			doc.Pages (0).Annotations.Add(sa)
			ef = EmbeddedFileStream.FromFile(doc, Path.Combine("Resources", "Images", "minerva.jpg"))
			ef.ModificationDate = [date]
			ef.MimeType = "image/jpeg"
			fs = FileSpecification.FromEmbeddedFile(ef)
			fs.UnicodeFile.FileName = fs.File.FileName
			fs.Relationship = AFRelationship.Unspecified
			doc.EmbeddedFiles.Add("minerva.jpg", fs)
			sa.AssociatedFiles.Add(fs)

			' Mark the document as conforming to Tagged PDF conventions (required for PDF/A):
			doc.MarkInfo.Marked = True

			' Metadata.CreatorTool and DocumentInfo.Creator should be the same for a PDF/A document:
			doc.Metadata.CreatorTool = doc.DocumentInfo.Creator
			' A title should be specified for PDF/A document:
			doc.Metadata.Title = "GcPdf Document"
			doc.ViewerPreferences.DisplayDocTitle = True

			' Done:
			doc.Save(stream)
		End Sub
	End Class
End Namespace
$vbLabelText   $csharpLabel

與 IronPDF 相比,GrapeCityPDF 提供的功能有限。 IronPDF 支援PDF/A 合規性PDF/UA 可存取性自訂紙張尺寸進階渲染選項

IronPDF的許可模式和定價是什麼?

30 天退款保證:購買許可證後,您將獲得 30 天退款保證。 如果許可證不能很好地滿足您的需求,IronPDF 將保證在 30 天內退款。

輕鬆整合:將 IronPDF 與正在運行的項目和您的環境整合是一個無縫過程,只需一行程式碼即可完成。 這可以在使用 NuGet Package 方法整合時達成,或直接線上下載並將其整合至您的環境中。

永久授權:只需購買一次許可證,無需續費。

免費支援和產品更新:每個許可證都將附帶自產品團隊的全方位支持,以及一年的免費產品更新。 在任何時候購買擴充套件都是可行的。 購買前可先檢視擴充套件。

立即發放許可證:收到付款後,立即發送已註冊的許可證密鑰。

所有許可均為永久性,可用於舞台搭建、開發和製作。

IronPDF 如何支援 Bootstrap 等現代 Web 框架?

現代 PDF 生成技術受益於視覺化流程表示。 這個 Bootstrap 5 範例展示了 IronPDF 用卡片、徽章和步驟指示器來呈現工作流程時間線的能力。 如需完整的框架支持,請參閱Bootstrap 和 Flexbox 故障排除指南

using IronPdf;

var renderer = new ChromePdfRenderer();

string workflowTimeline = @"
<!DOCTYPE html>
<html>
<head>
    <meta charset='utf-8'>
    <link href='___PROTECTED_URL_66___ rel='stylesheet'>
    <style>
        .timeline-item { position: relative; padding-left: 40px; margin-bottom: 30px; }
        .timeline-item::before { content: ''; position: absolute; left: 0; top: 0; width: 20px; height: 20px;
            background: #0d6efd; border-radius: 50%; border: 3px solid white; box-shadow: 0 0 0 2px #0d6efd; }
        .timeline-item::after { content: ''; position: absolute; left: 9px; top: 20px; width: 2px; height: calc(100% + 10px);
            background: #dee2e6; }
        .timeline-item:last-child::after { display: none; }
        @media print { .timeline-item { page-break-inside: avoid; } }
    </style>
</head>
<body class='bg-light'>
    <div class='container py-4'>
        <div class='text-center mb-5'>
            <h1 class='display-6 fw-bold'>PDF Generation Workflow</h1>
            <p class='lead text-muted'>From HTML to Professional PDF Documents</p>
        </div>

        <div class='timeline-item'>
            <div class='card shadow-sm'>
                <div class='card-body'>
                    <div class='d-flex justify-content-between align-items-center mb-2'>
                        <h4 class='card-title mb-0'>Step 1: Initialize Renderer</h4>
                        <span class='badge bg-primary'>Setup</span>
                    </div>
                    <p class='card-text'>Create ChromePdfRenderer instance with Chrome V8 engine for accurate HTML rendering.</p>
                    <div class='bg-light p-2 rounded'>
                        <code>var renderer = new ChromePdfRenderer();</code>
                    </div>
                    <div class='mt-2'>
                        <small class='text-muted'>✓ Chrome V8 Engine • ✓ Full CSS3 Support • ✓ JavaScript Ready</small>
                    </div>
                </div>
            </div>
        </div>

        <div class='timeline-item'>
            <div class='card shadow-sm'>
                <div class='card-body'>
                    <div class='d-flex justify-content-between align-items-center mb-2'>
                        <h4 class='card-title mb-0'>Step 2: Prepare HTML Content</h4>
                        <span class='badge bg-info'>Content</span>
                    </div>
                    <p class='card-text'>Design your document using modern HTML5, CSS3 (Flexbox/Grid), and optional JavaScript.</p>
                    <div class='row g-2'>
                        <div class='col-4'><span class='badge bg-success w-100'>HTML5</span></div>
                        <div class='col-4'><span class='badge bg-success w-100'>CSS3</span></div>
                        <div class='col-4'><span class='badge bg-success w-100'>JavaScript</span></div>
                    </div>
                </div>
            </div>
        </div>

        <div class='timeline-item'>
            <div class='card shadow-sm'>
                <div class='card-body'>
                    <div class='d-flex justify-content-between align-items-center mb-2'>
                        <h4 class='card-title mb-0'>Step 3: Render to PDF</h4>
                        <span class='badge bg-warning text-dark'>Processing</span>
                    </div>
                    <p class='card-text'>Convert HTML to PDF with pixel-perfect accuracy and sub-second performance.</p>
                    <div class='bg-light p-2 rounded'>
                        <code>var pdf = renderer.RenderHtmlAsPdf(htmlContent);</code>
                    </div>
                    <div class='progress mt-2' style='height: 8px;'>
                        <div class='progress-bar bg-warning' style='width: 100%'></div>
                    </div>
                    <small class='text-muted d-block mt-1'>Average render time: 0.9 seconds</small>
                </div>
            </div>
        </div>

        <div class='timeline-item'>
            <div class='card shadow-sm'>
                <div class='card-body'>
                    <div class='d-flex justify-content-between align-items-center mb-2'>
                        <h4 class='card-title mb-0'>Step 4: Save or Stream</h4>
                        <span class='badge bg-success'>Output</span>
                    </div>
                    <p class='card-text'>Export to file, stream, or byte array for flexible deployment options.</p>
                    <div class='bg-light p-2 rounded'>
                        <code>pdf.SaveAs("document.pdf");</code>
                    </div>
                    <div class='mt-2'>
                        <span class='badge bg-outline-secondary me-1'>File</span>
                        <span class='badge bg-outline-secondary me-1'>Stream</span>
                        <span class='badge bg-outline-secondary'>Byte Array</span>
                    </div>
                </div>
            </div>
        </div>

        <div class='alert alert-info'>
            <strong>Comparison Note:</strong> GrapeCity PDF Viewer focuses on document viewing and annotation, not HTML-to-PDF generation. IronPDF specializes in creating PDFs from modern web content with full Bootstrap and framework support.
        </div>

        <div class='card shadow-sm border-primary'>
            <div class='card-header bg-primary text-white'>
                <h5 class='mb-0'>Key Advantages</h5>
            </div>
            <div class='card-body'>
                <div class='row'>
                    <div class='col-md-6'>
                        <h6 class='text-primary'>IronPDF Strengths</h6>
                        <ul class='small'>
                            <li>Complete HTML-to-PDF workflow</li>
                            <li>Bootstrap 5 framework support</li>
                            <li>Async/await for scalability</li>
                            <li>Cross-platform deployment</li>
                        </ul>
                    </div>
                    <div class='col-md-6'>
                        <h6 class='text-muted'>GrapeCity Focus</h6>
                        <ul class='small'>
                            <li>PDF viewing and annotation</li>
                            <li>UI component for display</li>
                            <li>Limited generation features</li>
                            <li>Viewer-centric approach</li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>";

var pdf = renderer.RenderHtmlAsPdf(workflowTimeline);
pdf.SaveAs("workflow-timeline.pdf");
using IronPdf;

var renderer = new ChromePdfRenderer();

string workflowTimeline = @"
<!DOCTYPE html>
<html>
<head>
    <meta charset='utf-8'>
    <link href='___PROTECTED_URL_66___ rel='stylesheet'>
    <style>
        .timeline-item { position: relative; padding-left: 40px; margin-bottom: 30px; }
        .timeline-item::before { content: ''; position: absolute; left: 0; top: 0; width: 20px; height: 20px;
            background: #0d6efd; border-radius: 50%; border: 3px solid white; box-shadow: 0 0 0 2px #0d6efd; }
        .timeline-item::after { content: ''; position: absolute; left: 9px; top: 20px; width: 2px; height: calc(100% + 10px);
            background: #dee2e6; }
        .timeline-item:last-child::after { display: none; }
        @media print { .timeline-item { page-break-inside: avoid; } }
    </style>
</head>
<body class='bg-light'>
    <div class='container py-4'>
        <div class='text-center mb-5'>
            <h1 class='display-6 fw-bold'>PDF Generation Workflow</h1>
            <p class='lead text-muted'>From HTML to Professional PDF Documents</p>
        </div>

        <div class='timeline-item'>
            <div class='card shadow-sm'>
                <div class='card-body'>
                    <div class='d-flex justify-content-between align-items-center mb-2'>
                        <h4 class='card-title mb-0'>Step 1: Initialize Renderer</h4>
                        <span class='badge bg-primary'>Setup</span>
                    </div>
                    <p class='card-text'>Create ChromePdfRenderer instance with Chrome V8 engine for accurate HTML rendering.</p>
                    <div class='bg-light p-2 rounded'>
                        <code>var renderer = new ChromePdfRenderer();</code>
                    </div>
                    <div class='mt-2'>
                        <small class='text-muted'>✓ Chrome V8 Engine • ✓ Full CSS3 Support • ✓ JavaScript Ready</small>
                    </div>
                </div>
            </div>
        </div>

        <div class='timeline-item'>
            <div class='card shadow-sm'>
                <div class='card-body'>
                    <div class='d-flex justify-content-between align-items-center mb-2'>
                        <h4 class='card-title mb-0'>Step 2: Prepare HTML Content</h4>
                        <span class='badge bg-info'>Content</span>
                    </div>
                    <p class='card-text'>Design your document using modern HTML5, CSS3 (Flexbox/Grid), and optional JavaScript.</p>
                    <div class='row g-2'>
                        <div class='col-4'><span class='badge bg-success w-100'>HTML5</span></div>
                        <div class='col-4'><span class='badge bg-success w-100'>CSS3</span></div>
                        <div class='col-4'><span class='badge bg-success w-100'>JavaScript</span></div>
                    </div>
                </div>
            </div>
        </div>

        <div class='timeline-item'>
            <div class='card shadow-sm'>
                <div class='card-body'>
                    <div class='d-flex justify-content-between align-items-center mb-2'>
                        <h4 class='card-title mb-0'>Step 3: Render to PDF</h4>
                        <span class='badge bg-warning text-dark'>Processing</span>
                    </div>
                    <p class='card-text'>Convert HTML to PDF with pixel-perfect accuracy and sub-second performance.</p>
                    <div class='bg-light p-2 rounded'>
                        <code>var pdf = renderer.RenderHtmlAsPdf(htmlContent);</code>
                    </div>
                    <div class='progress mt-2' style='height: 8px;'>
                        <div class='progress-bar bg-warning' style='width: 100%'></div>
                    </div>
                    <small class='text-muted d-block mt-1'>Average render time: 0.9 seconds</small>
                </div>
            </div>
        </div>

        <div class='timeline-item'>
            <div class='card shadow-sm'>
                <div class='card-body'>
                    <div class='d-flex justify-content-between align-items-center mb-2'>
                        <h4 class='card-title mb-0'>Step 4: Save or Stream</h4>
                        <span class='badge bg-success'>Output</span>
                    </div>
                    <p class='card-text'>Export to file, stream, or byte array for flexible deployment options.</p>
                    <div class='bg-light p-2 rounded'>
                        <code>pdf.SaveAs("document.pdf");</code>
                    </div>
                    <div class='mt-2'>
                        <span class='badge bg-outline-secondary me-1'>File</span>
                        <span class='badge bg-outline-secondary me-1'>Stream</span>
                        <span class='badge bg-outline-secondary'>Byte Array</span>
                    </div>
                </div>
            </div>
        </div>

        <div class='alert alert-info'>
            <strong>Comparison Note:</strong> GrapeCity PDF Viewer focuses on document viewing and annotation, not HTML-to-PDF generation. IronPDF specializes in creating PDFs from modern web content with full Bootstrap and framework support.
        </div>

        <div class='card shadow-sm border-primary'>
            <div class='card-header bg-primary text-white'>
                <h5 class='mb-0'>Key Advantages</h5>
            </div>
            <div class='card-body'>
                <div class='row'>
                    <div class='col-md-6'>
                        <h6 class='text-primary'>IronPDF Strengths</h6>
                        <ul class='small'>
                            <li>Complete HTML-to-PDF workflow</li>
                            <li>Bootstrap 5 framework support</li>
                            <li>Async/await for scalability</li>
                            <li>Cross-platform deployment</li>
                        </ul>
                    </div>
                    <div class='col-md-6'>
                        <h6 class='text-muted'>GrapeCity Focus</h6>
                        <ul class='small'>
                            <li>PDF viewing and annotation</li>
                            <li>UI component for display</li>
                            <li>Limited generation features</li>
                            <li>Viewer-centric approach</li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>";

var pdf = renderer.RenderHtmlAsPdf(workflowTimeline);
pdf.SaveAs("workflow-timeline.pdf");
Imports IronPdf

Dim renderer = New ChromePdfRenderer()

Dim workflowTimeline As String = "
<!DOCTYPE html>
<html>
<head>
    <meta charset='utf-8'>
    <link href='___PROTECTED_URL_66___ rel='stylesheet'>
    <style>
        .timeline-item { position: relative; padding-left: 40px; margin-bottom: 30px; }
        .timeline-item::before { content: ''; position: absolute; left: 0; top: 0; width: 20px; height: 20px;
            background: #0d6efd; border-radius: 50%; border: 3px solid white; box-shadow: 0 0 0 2px #0d6efd; }
        .timeline-item::after { content: ''; position: absolute; left: 9px; top: 20px; width: 2px; height: calc(100% + 10px);
            background: #dee2e6; }
        .timeline-item:last-child::after { display: none; }
        @media print { .timeline-item { page-break-inside: avoid; } }
    </style>
</head>
<body class='bg-light'>
    <div class='container py-4'>
        <div class='text-center mb-5'>
            <h1 class='display-6 fw-bold'>PDF Generation Workflow</h1>
            <p class='lead text-muted'>From HTML to Professional PDF Documents</p>
        </div>

        <div class='timeline-item'>
            <div class='card shadow-sm'>
                <div class='card-body'>
                    <div class='d-flex justify-content-between align-items-center mb-2'>
                        <h4 class='card-title mb-0'>Step 1: Initialize Renderer</h4>
                        <span class='badge bg-primary'>Setup</span>
                    </div>
                    <p class='card-text'>Create ChromePdfRenderer instance with Chrome V8 engine for accurate HTML rendering.</p>
                    <div class='bg-light p-2 rounded'>
                        <code>var renderer = new ChromePdfRenderer();</code>
                    </div>
                    <div class='mt-2'>
                        <small class='text-muted'>✓ Chrome V8 Engine • ✓ Full CSS3 Support • ✓ JavaScript Ready</small>
                    </div>
                </div>
            </div>
        </div>

        <div class='timeline-item'>
            <div class='card shadow-sm'>
                <div class='card-body'>
                    <div class='d-flex justify-content-between align-items-center mb-2'>
                        <h4 class='card-title mb-0'>Step 2: Prepare HTML Content</h4>
                        <span class='badge bg-info'>Content</span>
                    </div>
                    <p class='card-text'>Design your document using modern HTML5, CSS3 (Flexbox/Grid), and optional JavaScript.</p>
                    <div class='row g-2'>
                        <div class='col-4'><span class='badge bg-success w-100'>HTML5</span></div>
                        <div class='col-4'><span class='badge bg-success w-100'>CSS3</span></div>
                        <div class='col-4'><span class='badge bg-success w-100'>JavaScript</span></div>
                    </div>
                </div>
            </div>
        </div>

        <div class='timeline-item'>
            <div class='card shadow-sm'>
                <div class='card-body'>
                    <div class='d-flex justify-content-between align-items-center mb-2'>
                        <h4 class='card-title mb-0'>Step 3: Render to PDF</h4>
                        <span class='badge bg-warning text-dark'>Processing</span>
                    </div>
                    <p class='card-text'>Convert HTML to PDF with pixel-perfect accuracy and sub-second performance.</p>
                    <div class='bg-light p-2 rounded'>
                        <code>var pdf = renderer.RenderHtmlAsPdf(htmlContent);</code>
                    </div>
                    <div class='progress mt-2' style='height: 8px;'>
                        <div class='progress-bar bg-warning' style='width: 100%'></div>
                    </div>
                    <small class='text-muted d-block mt-1'>Average render time: 0.9 seconds</small>
                </div>
            </div>
        </div>

        <div class='timeline-item'>
            <div class='card shadow-sm'>
                <div class='card-body'>
                    <div class='d-flex justify-content-between align-items-center mb-2'>
                        <h4 class='card-title mb-0'>Step 4: Save or Stream</h4>
                        <span class='badge bg-success'>Output</span>
                    </div>
                    <p class='card-text'>Export to file, stream, or byte array for flexible deployment options.</p>
                    <div class='bg-light p-2 rounded'>
                        <code>pdf.SaveAs(""document.pdf"");</code>
                    </div>
                    <div class='mt-2'>
                        <span class='badge bg-outline-secondary me-1'>File</span>
                        <span class='badge bg-outline-secondary me-1'>Stream</span>
                        <span class='badge bg-outline-secondary'>Byte Array</span>
                    </div>
                </div>
            </div>
        </div>

        <div class='alert alert-info'>
            <strong>Comparison Note:</strong> GrapeCity PDF Viewer focuses on document viewing and annotation, not HTML-to-PDF generation. IronPDF specializes in creating PDFs from modern web content with full Bootstrap and framework support.
        </div>

        <div class='card shadow-sm border-primary'>
            <div class='card-header bg-primary text-white'>
                <h5 class='mb-0'>Key Advantages</h5>
            </div>
            <div class='card-body'>
                <div class='row'>
                    <div class='col-md-6'>
                        <h6 class='text-primary'>IronPDF Strengths</h6>
                        <ul class='small'>
                            <li>Complete HTML-to-PDF workflow</li>
                            <li>Bootstrap 5 framework support</li>
                            <li>Async/await for scalability</li>
                            <li>Cross-platform deployment</li>
                        </ul>
                    </div>
                    <div class='col-md-6'>
                        <h6 class='text-muted'>GrapeCity Focus</h6>
                        <ul class='small'>
                            <li>PDF viewing and annotation</li>
                            <li>UI component for display</li>
                            <li>Limited generation features</li>
                            <li>Viewer-centric approach</li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>"

Dim pdf = renderer.RenderHtmlAsPdf(workflowTimeline)
pdf.SaveAs("workflow-timeline.pdf")
$vbLabelText   $csharpLabel

輸出:一個專業的流程時間軸 PDF,帶有 Bootstrap 5 卡片、徽章、進度條和自訂時間軸樣式。 IronPDF 可準確地渲染所有定位、flexbox 佈局和實用類別,為複雜的視覺設計展示全面的 CSS3 支援。

有關 Bootstrap 相容性的詳細信息,請參閱Bootstrap 和 Flexbox CSS 指南。 IronPDF 支援網頁字體和圖標,實現豐富的排版效果。

Lite套餐的價格是多少?

  • 1 名開發人員
  • 1 位置
  • 1 專案
  • 永久授權

該軟體包允許一位開發人員在一個位置為單一應用程式使用 Iron Software。 許可證不可轉讓給外部組織或代理/客戶關係。 不包括 OEM 再分發和未另行承保的 SaaS 使用。

定價:每年起價為 $999。

專業執照包含哪些內容?

  • 10 位開發人員
  • 10 個地點
  • 10 個專案
  • 永久授權

此授權允許十位開發人員在最多十個地點使用 Iron Software。 您可以將其用於無限數量的網站、內網應用程式或桌面軟體。 許可證不得轉讓給組織外部人員。 不包括 OEM 再分發和未另行承保的 SaaS 使用。 最多可與 10 個項目整合。

定價:每年起價為 $1,499。

無限許可有哪些好處?

  • 無限開發人員
  • 地點不限
  • 無限制的專案
  • 永久授權

允許同一組織內無限數量的開發人員在無限數量的地點使用 Iron Software。 可用於無限數量的應用程式。 許可證不得轉讓給組織外部人員。 不包括 OEM 再分發和未另行承保的 SaaS 使用。

定價:每年 2999 美元起。

免版稅再分發:您可以根據基本許可涵蓋的項目數量,將 Iron 軟體作為幾個不同包裝的商業產品的一部分進行分發(無需支付版稅)。 這將允許在 SaaS 軟體服務內部署 Iron Software,這是根據基本授權所涵蓋的專案數量而定。

定價:每年 1599 美元起。

IronPDF pricing tiers comparison showing Lite ($499), Professional ($999), and Unlimited ($2,999) licenses with different developer, location, and project limits

IronPDF 提供三種許可級別,其中專業版許可最受歡迎,售價 999 美元,包含 10 個開發人員、10 個地點和 10 個項目。

GrapeCity PDF 的授權模式和定價是什麼?

PDF授權文件包含哪些內容?

  • 包含 1 個開發人員授權
  • 1 分發地點

包含一個開發者許可證和一個分發位置,但不提供支援和維護。

定價:每年起價為 $1,499。

什麼是 Documents for PDF Unlimited?

  • 包含 1 個開發人員授權
  • 無限制的發行地點

包含一個開發者許可證,分發地點不限。 不提供技術支援和維護。 GrapeCity 不支援 SaaS 和 OEM。

定價:每年 2799 美元起。

Documents for PDF Team Unlimited 提供哪些服務?

  • 包含 5 個開發人員授權
  • 無限制的發行地點

包含五個開發者許可證,分發地點不限。 不提供技術支援和維護。 GrapeCity 不支援 SaaS 和 OEM。

定價:每年 5799 美元起。

Three pricing tiers for Documents for PDF software: basic at $999 per developer, Unlimited at $2799, and Team Unlimited at $5799, each with different license and distribution options.

`GrapeCity`'s Documents for PDF pricing structure offers three tiers to accommodate different development team sizes and distribution needs.

IronPDF Lite One-Developer 套餐包含 1 年對 $999 的支援。 GrapeCity PDF One-Developer 包的文件費用為 $1,499,不提供支援。 IronPDF 專業版包含 10 位開發人員,並提供一年的支援服務 $1,499。 GrapeCity 僅提供 5 個開發者套餐,售價 5799 美元。有關IronPDF 許可選項的更多信息,請訪問官方許可頁面。

IronPDF Lite 和 Professional 套餐包含 SaaS 服務、OEM 和 5 年支援選項。 Lite 單人開發者套餐包含五年支援、SaaS 和 OEM 服務,售價 2897 美元。 GrapeCity 不提供 SaaS、OEM 或 5 年支援服務。 Iron Professional 10 開發人員套餐包含 5 年支援、SaaS 和 OEM 服務,售價 3397 美元。 GrapeCity 缺少 10 開發人員選項。 了解長期支援的許可證延期升級選項

我的 .NET 專案應該選擇哪個 PDF 函式庫?

GrapeCity Documents for PDF 允許匯出/匯入、AcroForms 建立和在桌面應用程式中執行 PDF。 但是,對於包括表單建立數位簽章註解支援在內的完整 PDF 操作,IronPDF 提供了進階功能。

IronPDF 提供更高的精準度。 競爭對手可能會遇到影像轉換失敗或出現未知字元等問題。 IronPDF 提供精確的結果。 Chrome 渲染引擎可確保像素級完美渲染,並已透過像素級完美 HTML 轉 PDF 指南進行驗證。 如需最佳化,請參閱IronPDF 效能協助指南

IronPDF 提供具有競爭力的許可和支援服務,且無需持續費用。 IronPDF 從 $999 開始,提供完整的功能包。 GrapeCity PDF 起價為每年 1649 美元。 IronPDF 支援多種平台,價格統一。對於企業級部署,IronPDF 提供非同步和多執行緒功能,實現高效能產生。

您可以免費試用,體驗所有功能。 購買全套 Iron Suite 產品,即可享有兩件產品的價格,獲得五件產品。 有關IronPDF 許可的詳細信息,請訪問 Iron Software 的Iron Suite 產品頁面以獲取完整的軟體包資訊。

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

常見問題解答

如何在 .NET 中將 HTML 轉換為 PDF?

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

如何使用 NuGet 安裝 PDF 庫的步驟是什麼?

要通過 NuGet 安裝 IronPDF,請打開 Visual Studio,導航到 '管理 NuGet 套件',搜索 'IronPDF',然後點擊 '安裝' 將其添加到您的項目中。

有哪些 GrapeCity PDF 檢視器的 .NET 替代方案?

IronPDF 是 GrapeCity PDF 檢視器的合適替代方案,提供用戶友好的體驗,並對 .NET Core、.NET 5、Framework 和 Standard 提供廣泛支持。

如何使用 .NET 庫創建和閱讀 PDF 文件?

使用 IronPDF,您可以通過包含 IronPDF 名稱空間並使用 HtmlToPdf 類將 HTML 呈現為 PDF 來創建 PDF。要閱讀 PDF,您可以使用 PdfDocument 類來訪問和操控內容。

PDF 庫可用的許可選項有哪些?

IronPDF 提供一系列許可選項,包括單一開發人員的 Lite 套件、最多 10 名開發人員的專業許可,以及團隊的無限許可,所有這些都帶有永久許可和支持選項。

為什麼我應該選擇 IronPDF 而不是其他 PDF 解決方案?

推薦使用 IronPDF 是因為其精確度、全面的功能、有競爭力的許可和廣泛的支持選項。它以有競爭力的價格支持多個平台。

我可以在購買之前試用 PDF 庫嗎?

是的,IronPDF 提供免費試用版,使您可以在做出購買決策之前探索所有可用功能。此外,Iron Suite 套件以折扣價提供所有 Iron Software 產品的訪問。

使用 PDF 文件有哪些缺點?

由於其尺寸,PDF 通常難以通過電子郵件分享,並且相比 Word 文件在移動設備上顯示效果不夠清晰,與此同時,需要特定的軟件來編輯或更新。

Curtis Chau
技術作家

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

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

鋼鐵支援團隊

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