產品比較

IronPDF 和 GrapeCity PDF Viewer 之間的比較

發佈 2022年9月1日
分享:

PDF 代表可攜式文件格式。它是一種文件類型,允許在許多不同的設備上常規查看任何文件。PDF 經常被用來與潛在的雇主分享重要文件,如簡歷,或與客戶分享發票。

儘管其受歡迎程度,使用 PDF 作為存儲和共享資料的一種方式也有一些缺點。例如,PDF 不能通過電子郵件共享,因為它們需要先在 PDF 閱讀器中打開。即使可以,共享的 PDF 在手機上打開時看起來也不如 Word 文件那麼清晰。此外,PDF 無法像 Word 文件那樣進行編輯或更新,除非您的計算機上安裝了能夠識別文件中的數據並將其轉換回可編輯狀態的編輯軟件。這意味著無論您使用什麼設備——PC 或 Mac——打開 PDF 文件時,它們都看起來一樣。由於其實施的熟悉的標準,這使得 PDF 文件在所有設備上都很可靠,這是像 JPEG 或 GIF 等其他文件格式中找不到的。

在本文中,我們將回顧兩個 .NET PDF 庫:

  • IronPDF
  • GrapeCity PDF

IronPDF

IronPDF 是一個 .NET 函式庫,可用於創建、讀取和操作 PDF 文件,只需幾行代碼即可完成以下這篇文章將展示如何使用 IronPDF 創建 PDF 文件。本文假設您已經具備 Visual Studio 或 C# 的基本知識,並且擁有 HTML 的工作知識。

我們需要 Visual Studio 來編寫、編譯和運行我們的應用程序,使用 C# 編寫邏輯和代碼,並使用 HTML 來格式化 PDF 文件,包括添加標題、標題、圖片、段落等。IronPDF 函式庫完全支持 .NET Core、.NET 5、Framework 和 Standard。

我們只需幾行代碼即可在 C# 中創建 PDF 文件。只要具備基本的 C# 和 HTML 知識,這是一個簡單的任務。了解更多關於 IronPDF 的信息,請訪問這個 連結.

安裝 IronPDF

開發解決方案需要安裝 NuGet 套件。直接從菜單欄中點擊"專案"。會出現一個下拉清單。選擇管理 NuGet 套件 從下拉選單中選擇它。會顯示這樣的一個窗口:

選擇「瀏覽」選項卡,隨後會出現如下窗口:

在搜尋框中輸入「IronPdf」,然後按下「Enter」鍵。應該會出現結果視窗:

選擇 IronPDF:

如何使用 IronPDF 在 C# 中創建 PDF 文件

如何使用 IronPDF 在 C# 中創建 PDF 文件

選擇「安裝」按鈕。成功安裝後,將會出現結果視窗:

按下「確定」按鈕後,你就可以開始了。

創建PDF

添加命名空間 IronPDF 在檔案的頂端。

using IronPdf;
using IronPdf;
Imports IronPdf
VB   C#

實際工作從這一點開始。我們需要一個檔案路徑來儲存所構建的 PDF 文件。為了達成這個目標,我們使用 SaveFileDialog 來提示使用者選擇檔案名稱和檔案路徑。

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!");
    }
}
IRON VB CONVERTER ERROR developers@ironsoftware.com
VB   C#

SaveFileDialog 應該要打開一個文件對話框,允許您選擇要構建 PDF 文件的位置夾和文件名。初始目錄設置為 D 磁碟機,但您可以選擇設定為任何其他位置。由於我們只處理 PDF 文件,因此默認擴展名設置為 PDF 文件。

在 "if" 條件中,插入了實際創建 PDF 文件的代碼。現在我們可以看到,我們只用了兩行代碼就成功生成了一個 PDF 文件。PdfText 是包含將寫入 PDF 文檔中的文本的 Rich Text 框的名稱。文件名是通過 SaveFileDialog 方法選擇的文件路徑和名稱。

讀取 PDF

你可能會認為讀取 PDF 檔案的程式碼會很複雜且難以編寫或理解——但不用擔心——IronPDF 已經讓這個過程變得更簡單、更容易。這個過程只需要兩行代碼即可實現。!

新增下列程式碼以導入 IronPDF 文件頂部的庫。

using IronPdf;
using System;
using System.Windows.Forms;
using IronPdf;
using System;
using System.Windows.Forms;
Imports IronPdf
Imports System
Imports System.Windows.Forms
VB   C#

在函數內寫入以下代碼。

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
VB   C#

這將從數據源中提取所有信息到文件查看器。所有報告組件將使用該數據作為數據來源。

GrapeCity PDF 功能

GrapeCity Documents 是一個跨平台的文件管理系統,提供一個通用的文件、編輯器和閱讀器解決方案,適用於所有常見的文件格式。無需像 Adobe Acrobat 這樣的附加程序,該系統供應的 .NET Standard 2.0 豐富的庫可以用來讀取、生成、修改和保存 PDF 文件。它擁有強大的功能集,讓開發人員可以構建包含高級字體支援、照片、圖形、條碼、評論、大綱、印章、水印等的 PDF 文件。

操作PDF

在 .NET Standard 應用程式中,您可以使用 GrapeCityPDF 來生成具有基本或複雜業務需求的 PDF 文件。此外,您可以從任何來源加載、更改和保存 PDF。

將 PDF 儲存為圖片

您可以使用 GrapeCityPDF 在不犧牲圖片品質的情況下將 PDF 儲存為圖片。此外,您只需使用幾行代碼即可實現此功能。

PDF 查看器

GrapeCity Documents PDF Viewer 是基於輕量級編程的客戶端 PDF 文件查看器。支持許多常見的 PDF 功能。

許多功能

GrapeCityPDF 庫具有許多功能,使您能夠創建包含文字、圖形、照片、註釋、大綱等信息的複雜 PDF 文檔。

安裝

有兩種方法可以安裝 GrapeCity。

  1. 選擇 download zipped source files 按鈕以下載當前的示例源文件。
  2. 將下載的 zip 文件直接解壓縮到您電腦上的目錄中。
  3. 導航到該目錄。
  4. 執行 run.cmd 批處理文件。這將構建示例源文件,啟動 SupportApi 服務並在默認瀏覽器中打開 http://localhost:3003 URL。
  5. 欲了解更多信息,請參閱下載的 zip 中包含的 readme.MD 文件。

安裝 WinForms 版本

下文討論了安裝 WinForms 版本的程序。以下步驟提供了安裝 WinForms 版本的說明:

  • 從下載 C1ControlPanel https://www.grapecity.com/componentone 安裝最新版本的 WinForms。
  • 使用 ComponentOneC1ControlPanel.exe 打開 控制面板。所有正在運行的 Visual Studio 實例必須關閉。
  • 現有用戶可以使用註冊的電子郵件地址和密碼登錄。
  • 如果您是新用戶:

    • 註冊 Component One 並通過填寫必填字段創建帳戶。

    • 驗證郵件將發送到您的電子郵件地址。

    • 通過點擊驗證鏈接來激活您的電子郵件地址。
  • 如果您不想登錄或註冊,您可以作為匿名用戶繼續操作。
  • 在 WinForms 版本磁貼中,選擇 安裝。選擇 所有版本 對應的複選框即可安裝所有版本。選擇 查看更多 按鈕以了解更多關於該版本的信息。
GrapeCity PDF 安装

  • 在您點擊安裝後,會顯示一個要求您查看許可協議的頁面,然後點擊接受許可協議按鈕。
  • 接受許可協議後,會顯示一個包含設置和更改目錄路徑按鈕的頁面。選擇接受設置提示以驗證目錄路徑並開始安裝過程。
GrapeCity PDF 安装

  • 安裝程式會安裝控制項並顯示其進度。顯示此畫面時,您將無法取消安裝過程。
  • 控制項安裝完成後,將顯示 "安裝成功" 畫面。當前安裝版本將顯示在相應的版本中。
  • 安裝程式會安裝控制項並顯示其進度。顯示此畫面時,您將無法取消安裝過程。
GrapeCity PDF 安装

  • 一旦安裝控件後,將顯示“安裝成功”的畫面。當前安裝的版本將顯示在相應的版本中。
GrapeCity PDF 安装

建立 PDF

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);
        }
    }
}
IRON VB CONVERTER ERROR developers@ironsoftware.com
VB   C#

GrapeCityPDF 不是一個先進的 PDF 庫——它相比 IronPDF 功能較少。

IronPDF 許可模式和定價

30天退款保證:一旦購買許可證,您將收到30天退款保證。如果許可證不符合您的需求,IronPDF將在30天內保證退款。

容易整合:在您的專案和環境中整合IronPDF是一個使用一行代碼就能完成的無縫過程。可以通過NuGet Package方法進行整合,也可以直接在線下載並整合到您的環境中。

永久許可:每個許可證只需一次購買,無需續期。

免費支持和產品更新:每個許可證都將包括來自產品團隊的全天候支持以及一年的免費產品更新。可以在任何時候購買擴展包。購買前可以查看擴展包。

即時許可證:一旦收到付款,註冊許可證密鑰將立即發送。

所有許可證都是永久性的,適用於測試、開發和生產環境。

精簡套裝

  • 1 名開發者
  • 1 個地點
  • 1 個專案
  • 永久授權

此套裝允許組織中的單一軟體開發者在一個地點使用 Iron Software。Iron Software 可以在單一內部網路應用程式、網頁應用程式或桌面軟體程式中使用。此授權禁止在組織外部或機構/客戶關係中共享,因為它們是不可轉讓的。此授權類型,與所有其他授權類型一樣,明確排除所有在協議下未明確授權的權利,並且在沒有 OEM 重新分配及未購買額外保險的情況下,禁止作為 SaaS 使用。

價格:從每年 $749 起。

Professional License

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

此授權允許組織中的預定數量的軟體開發人員在多個地點使用 Iron Software,最多達十個地點。Iron Software 可以在無限多的網站、內部網應用或桌面軟體應用中使用。授權不可轉讓,禁止在組織或代理商/客戶關係之外共享。此授權類型,如所有其他授權類型,明確排除在協議中未明確授予的所有權利,包括 OEM 重新分發及在未購買額外保險範圍的情況下將 Iron Software 用於 SaaS(軟體即服務)。此授權可集成於一個專案,最多達十個。

價錢: 每年從 $999 起。

Unlimited License

  • 無限制的開發者
  • 無限制的位置
  • 無限制的項目
  • 永久授權

這使您能夠在一個組織內擁有無限制數量的軟體開發人員,在無限制的位置使用 Iron Software。Iron Software 可以用於任意數量的內部網應用、桌面軟體應用程式或網站。授權不可轉讓,也不得在組織或代理/客戶關係之外共享。此授權類型,如同所有其他授權類型一樣,明確排除在協議中未授予的所有權利,包括 OEM 轉散發和在未購買額外保險覆蓋的情況下作為 SaaS 使用。

價格: 從每年 $2999 起。

免版稅再發行: 這允許您將 Iron Software 作為多個不同包裝的商業產品的一部分进行散布。 (無需支付版稅) 根據基礎授權所涵蓋的專案數量。 這將允許在SaaS軟體服務中部署Iron Software,這是基於基礎授權所涵蓋的專案數量。

價格: 每年起價$ 1599。

GrapeCity PDF 安装

GrapeCity PDF 授權模式與定價

PDF 文件

  • 包括1个开发者许可
  • 1个分发地点

此套餐包括一个开发者许可,并且只有一个分发地点,不包含支持和维护。

价格: 每年起价$999。

無限PDF文件

  • 包含 1 個開發者許可證
  • 無限分發地點

此套件包含一個具無限分發地點的開發者許可證。它不包含支援和維護。它不支持SaaS和OEM。

定價:起價為 $2799 每年。

PDF 團隊不限文件

  • 包含 5 個開發者授權
  • 無限分發地點

此套件包含五個開發者授權與無限分發地點,無支援與維護。GrapeCity 不支援 SaaS 和 OEM。

價格: 每年起價 $5799。

GrapeCity PDF 套件比較

IronPDF Lite 開發者單人套件包含一年的支援,費用約為 $749。而GrapeCity Documents for PDF 包含開發者單人套件,且不包含任何支援的價格為 $999。IronPDF 專業套件,包含 10 開發者套件和一年支援,費用為 $999。另一方面,GrapeCity 沒有 10 開發者套件——只有 5 開發者套件,費用為 $5799。

IronPDF LiteProfessional 套件都包含 SaaS 服務或 OEM,以及 5 年支援選項。Lite 開發者單人套件提供五年的支援、SaaS 和 OEM 服務,費用為 $2897 美元。而 GrapeCity 沒有 SaaS、OEM 服務或 5 年支援選項。Iron Professional 10 開發者套件包含 5 年支援、SaaS 和 OEM 服務,費用為 $3397 美元。而 GrapeCity 沒有任何 10 開發者套件。

結論

GrapeCity Documents for PDF 允許開發者匯出/匯入,創建 AcroForms (PDF 表單),並在多個桌面應用程式上執行PDF。使用 GrapeCity Documents for PDF(GcPdf), 您正在为您的客户提供完整的 PDF 解决方案。

我們強烈推薦 IronPDF,因為該產品提供更高的準確性。許多執行類似功能的競爭對手可能會遇到轉換過程中的不準確問題,例如無法轉換某些圖像,導致未知字符。另一方面,IronPDF 提供準確的結果。

IronPDF 套件提供具有競爭力的授權和支援,且無需持續費用。IronPDF 的價格從 $749 起,套件包括更多功能。GrapeCity PDF 的價格從 $1649 每年起。IronPDF 還支持多個平台,且僅需一個價格。!

如果你還不是 IronPDF 的客戶,你可以透過免費試用來檢查所有可用的功能。如果你購買完整的 Iron Suite,便可以以兩個產品的價格獲得全部五個產品。若需更多詳細資訊,請參閱 授權,請遵循這個 連結 查看完整的套件資訊。

< 上一頁
IronPDF與XFINIUM.PDF的比較
下一個 >
IronPDF 與 Textcontrol 的比較

準備開始了嗎? 版本: 2024.10 剛剛發布

免費 NuGet 下載 總下載次數: 10,993,239 查看許可證 >