在生产环境中测试,无水印。
随时随地满足您的需求。
获得30天的全功能产品。
几分钟内就能启动并运行。
在您的产品试用期间,全面访问我们的支持工程团队。
GroupDocs 和 IronPDF 都是跨平台的应用程序,为工程师提供文档自动化工具,能够创建、编辑、格式化和打印 PDF 文档--目前使用最广泛的文档格式之一。 在使用 .NET 和 .NET Core 构建项目时,开发人员必须选择最适合其项目需求的工具。
开发人员需要充分了解可用的库和工具,PDF 库也不例外。 每个库都有自己的优缺点,开发人员必须选择最符合业务和项目要求的工具。
本文将对 .NET 和 .NET Core 开发人员最常用的两个 PDF 库进行比较:GroupDocs 和 IronPDF。
IronPDF 是基于 C# 的商业 PDF 创建包,适用于 .NET 平台。 该工具可从 HTML、CSS、图像和 JavaScript 生成 PDF,因此适用于网络应用程序、安全内网、控制台应用程序、WPF 应用程序和 MVC 模式网站。 IronPDF 兼容所有从版本 4 开始的 .NET Framework 和 .NET Core 项目。有关更多详情,请访问 IronPDF 官方网站。
GroupDocs.Editor API 是一个跨平台的 .NET 库,为开发人员提供了创建简单应用程序的能力,这些应用程序可以与流行的 HTML 编辑器(包括免费和付费)无缝对接,以便在各种文件格式中转换、编辑和操作文档。 您可以在此处了解更多关于其功能的信息。
GroupDocs.Annotation for .NET 使开发人员能够使用 C#、ASP.NET 和其他 .NET 技术创建应用程序,能够执行文档注释功能,如绘制形状、添加文本和图像以及突出显示文本。 可以对注释进行操作,并将其保存为原始文件类型。
// Initialize list of AnnotationInfo
List<AnnotationInfo> annotations = new List<AnnotationInfo>();
// Initialize text annotation
AnnotationInfo textAnnotation = new AnnotationInfo
{
Box = new Rectangle((float)265.44, (float)153.86, 206, 36), Type = AnnotationType.Text
};
// Add annotation to list
annotations.Add(textAnnotation);
// Get input file stream
Stream inputFile = new FileStream("D:/input.pdf", FileMode.Open, FileAccess.ReadWrite);
// Export annotation and save the output file
CommonUtilities.SaveOutputDocument(inputFile, annotations, DocumentType.Pdf);
// Initialize list of AnnotationInfo
List<AnnotationInfo> annotations = new List<AnnotationInfo>();
// Initialize text annotation
AnnotationInfo textAnnotation = new AnnotationInfo
{
Box = new Rectangle((float)265.44, (float)153.86, 206, 36), Type = AnnotationType.Text
};
// Add annotation to list
annotations.Add(textAnnotation);
// Get input file stream
Stream inputFile = new FileStream("D:/input.pdf", FileMode.Open, FileAccess.ReadWrite);
// Export annotation and save the output file
CommonUtilities.SaveOutputDocument(inputFile, annotations, DocumentType.Pdf);
IRON VB CONVERTER ERROR developers@ironsoftware.com
IronPDF允许用户使用诸如IronPdf.PdfDocument.AddTextAnnotation
之类的方法以编程方式注释PDF文档。
using PdfDocument Pdf = PdfDocument.FromFile("existing.pdf");// Create a PDF annotation object
var Annotation = new IronPdf.Annotations.TextAnnotation()
{
Title = "This is the major title",
Subject = "This is a subtitle",
Contents = "This is the long 'sticky note' comment content...",
Icon = IronPdf.Annotations.TextAnnotation.AnnotationIcon.Help,
Opacity = 0.9,
Printable = false,
Hidden = false,
OpenByDefault = true,
ReadOnly = false,
Rotateable = true
};
// Add the annotation "sticky note" to a specific page and location within any new or existing PDF.
Pdf.AddTextAnnotation(Annotation, 1, 150, 250);
Pdf.SaveAs("existing.pdf");
using PdfDocument Pdf = PdfDocument.FromFile("existing.pdf");// Create a PDF annotation object
var Annotation = new IronPdf.Annotations.TextAnnotation()
{
Title = "This is the major title",
Subject = "This is a subtitle",
Contents = "This is the long 'sticky note' comment content...",
Icon = IronPdf.Annotations.TextAnnotation.AnnotationIcon.Help,
Opacity = 0.9,
Printable = false,
Hidden = false,
OpenByDefault = true,
ReadOnly = false,
Rotateable = true
};
// Add the annotation "sticky note" to a specific page and location within any new or existing PDF.
Pdf.AddTextAnnotation(Annotation, 1, 150, 250);
Pdf.SaveAs("existing.pdf");
Using Pdf As PdfDocument = PdfDocument.FromFile("existing.pdf") ' Create a PDF annotation object
Dim Annotation = New IronPdf.Annotations.TextAnnotation() With {
.Title = "This is the major title",
.Subject = "This is a subtitle",
.Contents = "This is the long 'sticky note' comment content...",
.Icon = IronPdf.Annotations.TextAnnotation.AnnotationIcon.Help,
.Opacity = 0.9,
.Printable = False,
.Hidden = False,
.OpenByDefault = True,
.ReadOnly = False,
.Rotateable = True
}
' Add the annotation "sticky note" to a specific page and location within any new or existing PDF.
Pdf.AddTextAnnotation(Annotation, 1, 150, 250)
Pdf.SaveAs("existing.pdf")
End Using
IronPdf 的注释功能包括颜色选择、元素大小调整、不透明度设置和文本编辑等选项。
在文档处理中,将某些文件格式转换为 PDF 是必不可少的。 以下是 GroupDocs 和 IronPDF 进行转换的对比:
GroupDocs Conversion API 可将 MS Word 和 Excel 等各种文档类型转换为 PDF,而无需使用其他生产力套件。
using System;
using GroupDocs.Conversion.Options.Convert;
namespace ConvertXlsbToPdfInCSharp
{
class Program
{
public static void Main(string [] args)
{
// Load license
string licensePath = "GroupDocs.Conversion.lic";
GroupDocs.Conversion.License lic = new GroupDocs.Conversion.License();
lic.SetLicense(licensePath);
// Load source XLSB for conversion
var converter = new GroupDocs.Conversion.Converter("sample.xlsb");
// Conversion options
var convertOptions = new PdfConvertOptions();
// Convert XLSB to PDF
converter.Convert("converted.pdf", convertOptions);
Console.WriteLine("Done");
}
}
}
using System;
using GroupDocs.Conversion.Options.Convert;
namespace ConvertXlsbToPdfInCSharp
{
class Program
{
public static void Main(string [] args)
{
// Load license
string licensePath = "GroupDocs.Conversion.lic";
GroupDocs.Conversion.License lic = new GroupDocs.Conversion.License();
lic.SetLicense(licensePath);
// Load source XLSB for conversion
var converter = new GroupDocs.Conversion.Converter("sample.xlsb");
// Conversion options
var convertOptions = new PdfConvertOptions();
// Convert XLSB to PDF
converter.Convert("converted.pdf", convertOptions);
Console.WriteLine("Done");
}
}
}
Imports System
Imports GroupDocs.Conversion.Options.Convert
Namespace ConvertXlsbToPdfInCSharp
Friend Class Program
Public Shared Sub Main(ByVal args() As String)
' Load license
Dim licensePath As String = "GroupDocs.Conversion.lic"
Dim lic As New GroupDocs.Conversion.License()
lic.SetLicense(licensePath)
' Load source XLSB for conversion
Dim converter = New GroupDocs.Conversion.Converter("sample.xlsb")
' Conversion options
Dim convertOptions = New PdfConvertOptions()
' Convert XLSB to PDF
converter.Convert("converted.pdf", convertOptions)
Console.WriteLine("Done")
End Sub
End Class
End Namespace
GroupDocs 可将 HTML 文档转换为 PDF 格式,这对于将网页内容转换为可打印的档案非常有用。 您可以在这里查看将HTML转换为PDF的完整教程。
using System;
using GroupDocs.Conversion.Options.Convert;
namespace ConvertHtmlToPdfInCSharp
{
class Program
{
public static void Main(string [] args)
{
// Use license
string licensePath = "GroupDocs.Conversion.lic";
GroupDocs.Conversion.License lic = new GroupDocs.Conversion.License();
lic.SetLicense(licensePath);
// Load HTML document
var converter = new GroupDocs.Conversion.Converter("sample.html");
// PDF options
var convertOptions = new PdfConvertOptions();
// HTML to PDF
converter.Convert("converted.pdf", convertOptions);
Console.WriteLine("Done");
}
}
}
using System;
using GroupDocs.Conversion.Options.Convert;
namespace ConvertHtmlToPdfInCSharp
{
class Program
{
public static void Main(string [] args)
{
// Use license
string licensePath = "GroupDocs.Conversion.lic";
GroupDocs.Conversion.License lic = new GroupDocs.Conversion.License();
lic.SetLicense(licensePath);
// Load HTML document
var converter = new GroupDocs.Conversion.Converter("sample.html");
// PDF options
var convertOptions = new PdfConvertOptions();
// HTML to PDF
converter.Convert("converted.pdf", convertOptions);
Console.WriteLine("Done");
}
}
}
Imports System
Imports GroupDocs.Conversion.Options.Convert
Namespace ConvertHtmlToPdfInCSharp
Friend Class Program
Public Shared Sub Main(ByVal args() As String)
' Use license
Dim licensePath As String = "GroupDocs.Conversion.lic"
Dim lic As New GroupDocs.Conversion.License()
lic.SetLicense(licensePath)
' Load HTML document
Dim converter = New GroupDocs.Conversion.Converter("sample.html")
' PDF options
Dim convertOptions = New PdfConvertOptions()
' HTML to PDF
converter.Convert("converted.pdf", convertOptions)
Console.WriteLine("Done")
End Sub
End Class
End Namespace
IronPdf 利用 Chromium 引擎准确地将 HTML 转换为 PDF。
IronPDF 可以通过简单的实现将 HTML 内容直接转换为 PDF。
using IronPdf;
var Renderer = new IronPdf.ChromePdfRenderer();
using var PDF = Renderer.RenderHtmlAsPdf("<h1>Html with CSS and Images</h1>");
PDF.SaveAs("pixel-perfect.pdf");
using IronPdf;
var Renderer = new IronPdf.ChromePdfRenderer();
using var PDF = Renderer.RenderHtmlAsPdf("<h1>Html with CSS and Images</h1>");
PDF.SaveAs("pixel-perfect.pdf");
Imports IronPdf
Private Renderer = New IronPdf.ChromePdfRenderer()
Private PDF = Renderer.RenderHtmlAsPdf("<h1>Html with CSS and Images</h1>")
PDF.SaveAs("pixel-perfect.pdf")
要获得更多的变革力量,请考虑查看IronPDF文档关于HTML到PDF转换器。
使用 IronPDF 可以直接将整个网页 URL 转换为 PDF 格式,它使用的是自定义浏览器引擎。
using IronPdf;
IronPdf.ChromePdfRenderer Renderer = new IronPdf.ChromePdfRenderer();
using var Pdf = Renderer.RenderUrlAsPdf("https://ironpdf.com/");
Pdf.SaveAs("url.pdf");
using IronPdf;
IronPdf.ChromePdfRenderer Renderer = new IronPdf.ChromePdfRenderer();
using var Pdf = Renderer.RenderUrlAsPdf("https://ironpdf.com/");
Pdf.SaveAs("url.pdf");
Imports IronPdf
Private Renderer As New IronPdf.ChromePdfRenderer()
Private Pdf = Renderer.RenderUrlAsPdf("https://ironpdf.com/")
Pdf.SaveAs("url.pdf")
有关使用IronPDF进行URL到PDF转换的更多信息,请访问官方API指南。
IronPDF 和 GroupDocs 在 PDF 文档处理方面各有独特优势。 IronPdf 在简单易用方面表现出色,只需最少的设置和有效的 HTML 渲染。 GroupDocs 可全面覆盖 PDF 以外的更多文档类型,适用于各种转换要求。 IronPDF的授权是透明的,可在IronPDF定价页面上查看选项,提供适合不同项目规模和需求的选项。
随着对 PDF 签名和文档处理功能需求的增长,了解这些库的优势可以帮助开发人员根据自己的需求选择合适的工具。 在这里探索有关Iron Software不断创新和特性的更多信息。