产品比较

IronPDF与GrapeCity PDF Viewer的比较

Chipego
奇佩戈-卡琳达
2022年九月1日
分享:

PDF 是便携式文档格式的缩写。 这种文件类型允许在许多不同设备上以常规方式查看任何文件。 PDF 通常用于与潜在雇主共享简历或与客户共享发票等重要文件。

尽管 PDF 很受欢迎,但将其作为一种存储和共享数据的方式也有一些缺点。 例如,PDF 文件不能通过电子邮件共享,因为它们需要先在 PDF 阅读器中打开。即使可以,PDF 文件在手机上打开时也不会像 Word 文档那样清晰。 此外,PDF 文件不能像 Word 文档那样进行编辑或更新,除非您的计算机上安装了编辑软件,可以识别文件中的数据并将其转换为可编辑的形式。 这意味着,无论您使用的是 PC 还是 Mac,在打开 PDF 文件时,它们的外观都是一样的。 这使得 PDF 文件在所有设备上都非常可靠,因为它们采用的标准是其他文件格式(如 JPEG 或 GIF)所不具备的。

本文将介绍两个 .NET PDF 库:

  • IronPDF
  • 葡萄城 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 的信息。

安装 IronPDF

开发解决方案需要安装IronPDF的NuGet包。 直接从菜单栏点击 "项目"。 此时会出现一个下拉列表。 从下拉菜单中选择“管理NuGet 包”并选择它。 将显示类似的窗口:

Grapecity Pdf Viewer Alternatives 1 related to 安装 IronPDF

选择 "浏览 "选项卡,随后会出现如下窗口:

Grapecity Pdf Viewer Alternatives 2 related to 安装 IronPDF

在搜索框中输入 "IronPdf",然后按 "Enter"。结果窗口就会出现:

Grapecity Pdf Viewer Alternatives 3 related to 安装 IronPDF

选择 IronPDF:

如何通过 Ironpdfile 在 C# 中创建 PDF 文件

如何通过 Ironpdfile 在 C# 中创建 PDF 文件

选择 "安装 "按钮。 安装成功后,会出现相应的窗口:

Grapecity Pdf Viewer Alternatives 5 related to 安装 IronPDF

按下 "确定 "按钮后,就可以开始了。

创建 PDF

在文件顶部添加IronPdf命名空间。

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

实际工作从这里开始。 我们需要一个文件路径来存储生成的 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
$vbLabelText   $csharpLabel

SaveFileDialog 应该会打开一个文件对话框,允许您在要创建 PDF 文档的位置选择文件夹和文件名。 初始目录设置为 D 盘,但您可以选择将其设置为任何盘符。 由于我们只处理 PDF 文件,因此默认扩展名已设置为 PDF 文件。

在 "如果 "条件中,插入了创建 PDF 文件的实际代码。 现在我们可以看到,我们只用了两行代码就成功生成了 PDF 文件。 PdfText 是富文本框的名称,其中包含将写入 PDF 文档的文本。 文件名是通过 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
$vbLabelText   $csharpLabel

在函数内编写以下代码

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

这将从数据源提取所有信息到文档查看器。 所有报告组件都将使用该数据作为数据源。

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. 选择下载压缩源文件按钮以下载当前示例源。

  2. 直接从下载的压缩包中提取文件到计算机上的一个目录中。

  3. 导航至该目录。

  4. 执行run.cmd批处理文件。这将构建示例源代码。 启动 SupportApi 服务,并在默认浏览器中打开 http://localhost:3003 URL。

  5. 更多信息,请参阅下载压缩包中的 readme.MD。

安装 WinForms 版本

下面的话题讨论了安装WinForms版本的程序。 以下步骤提供了安装 WinForms 版的说明:

  • 从[GrapeCity的ComponentOne](https://www.grapecity.com/componentone" target="_blank" rel="nofollow noopener noreferrer)下载C1ControlPanel以安装WinForms的最新版本。
  • 使用ComponentOneC1ControlPanel.exe打开ControlPanel。 必须关闭任何正在运行的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
$vbLabelText   $csharpLabel

GrapeCityPDF 并非 PDF 的高级库--与 IronPDF 相比,它的功能有限。

IronPDF 许可证模式和定价

30天退款保证:购买许可证后,您将获得30天的退款保证。 如果许可证不能很好地满足您的需求,IronPDF 将保证在 30 天内退款。

轻松集成: 在一个正在运行的项目和您的环境中集成IronPDF是一个无缝的过程,只需一行代码即可完成。 这可以在使用 NuGet 软件包方法集成时实现,也可以直接在线下载并集成到您的环境中。

永久授权:每个许可证仅需购买一次,无需续费。

免费支持和产品更新:每个许可将附带产品团队直接提供的全面支持,以及一年的免费产品更新。 在任何时候购买扩展都是可行的。 在购买之前,可以查看扩展部分。

即时许可:一旦收到付款,即可发送注册的许可证密钥。

所有许可证均为永久许可证,适用于暂存、开发和生产。

简易套餐

  • 1 开发人员
  • 1 个地点
  • 项目
  • 永久许可证

    该软件包允许企业中的单个软件开发人员在一个位置使用 Iron Software。 Iron Software 可用于单个内联网应用程序、网络应用程序或桌面软件程序。 禁止在组织或代理/客户关系之外共享许可证,因为许可证是不可转让的。 本许可类型与所有其他许可类型一样,明确排除本协议未明确授予的所有权利,不进行 OEM 再分发,也不在不购买额外保险的情况下将 Iron Software 作为 SaaS 使用。

    定价:每年起价为$749。

专业许可证

  • 10 个开发人员
  • 10 个地点
  • 10 个项目
  • 永久许可证

    该许可证允许一个组织中预定数量的软件开发人员在多个地点使用 Iron Software,最多不超过 10 人。 Iron Software 可用于任意数量的网站、内网应用程序或桌面软件应用程序。许可证不可转让,因此禁止在组织或代理/客户关系之外共享许可证。 本许可类型与所有其他许可类型一样,明确排除本协议未明确授予的所有权利,包括 OEM 再分发和在未购买额外保险的情况下将 Iron Software 作为 SaaS 使用。 该许可证可与单个项目集成,最多可集成 10 个项目。

    价格:起价为每年 $999。

无限版许可

  • 无限开发者
  • 不限地点
  • 无限项目
  • 永久许可证

    这样,您就可以在一个组织中拥有不限数量的软件开发人员,在不限数量的地点使用 Iron Software。 Iron Software 可用于任意数量的内网应用程序、桌面软件应用程序或网站。许可证不得转让,也不得在组织或代理/客户关系之外共享。本许可类型与所有其他许可类型一样,明确排除本协议未授予的所有权利,包括 OEM 再分发和在未购买额外保险的情况下将 Iron Software 作为 SaaS 使用。

    价格:起价为每年 $2999。

    免版税再分发:这允许您根据基础许可证涵盖的项目数量,将Iron Software作为多个不同包装的商业产品的一部分进行分发(无需支付版税)。 这样,就可以在 SaaS 软件服务中部署 Iron Software,这是以基本许可证所涵盖的项目数量为基础的。

    价格:起价为每年 $1599。

    GrapeCity PDF 安装

GrapeCity PDF 许可模式和定价

PDF 文件

  • 包括 1 个开发人员许可证
  • 1 分配地点

    该软件包包括一个开发人员许可证和一个分发位置,不提供支持和维护。

    定价:每年起价$999。

PDF 无限文档

  • 包括 1 个开发人员许可证
  • 配送地点不受限制

    该软件包包含一个开发者许可,可无限版发布。 它不附带支持和维护。 GrapeCity 不支持 SaaS 和 OEM。

    价格:每年起价为 $2799。

PDF Team Unlimited 的文件

  • 包括 5 个开发人员许可证
  • 配送地点不受限制

    该软件包包括五个开发人员许可,可无限版发布位置,无需支持和维护。 GrapeCity 不支持 SaaS 和 OEM。

    价格:起价为每年 $5799。

    GrapeCity PDF 套装比较

    IronPDF Lite 单一开发者套餐附有1年支持,费用约为$749。 而 GrapeCity Documents for PDF 包含一个开发人员包,价格为 999 美元,不含任何支持。 IronPDF 专业软件包,包括10位开发者的软件包,并附带一年的支持,价格为999美元。另一方面,GrapeCity没有10位开发者的软件包,仅有5位开发者的软件包,价格为5799美元。

IronPDF LiteProfessional 套餐包含 SaaS 服务或 OEM,以及 5 年支持选项。 一个开发人员的精简版软件包提供五年的支持、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 授权的更多详细信息,请访问 Iron Software 的Iron Suite 产品页面以查看完整的配套信息。

Chipego
软件工程师
Chipego 拥有出色的倾听技巧,这帮助他理解客户问题并提供智能解决方案。他在 2023 年加入 Iron Software 团队,此前他获得了信息技术学士学位。IronPDF 和 IronOCR 是 Chipego 主要专注的两个产品,但他对所有产品的了解每天都在增长,因为他不断找到支持客户的新方法。他喜欢 Iron Software 的合作氛围,公司各地的团队成员贡献他们丰富的经验,以提供有效的创新解决方案。当 Chipego 离开办公桌时,你经常可以发现他在看书或踢足球。
< 前一页
IronPDF和XFINIUM.PDF的比较
下一步 >
IronPDF与Textcontrol的对比