乐于分享
好东西不私藏

可靠的 .NET PDF 处理库

可靠的 .NET PDF 处理库

.NET PDF SDK 是一款强大的解决方案,支持 OCR、数据提取、批量处理和编辑 PDF 文档。完整的 PDF 功能集和高质量的输出,简易的部署让您快速启动!

语言与框架支持

支持 C#、VB.NET 和 F#,运行在 .NET Core、.NET Standard 或 .NET Framework 上。

.NET PDF 库代码示例

PDF转换

1 string inputFilePath = "InputFile.pdf";

2 string outputFolderPath = "OutputFold";

3 string outputFileName = "OutputFile.docx";

4

5 // Initialize conversion instance.

6 CPDFConverterWord converter = CPDFConvertFactroy.CreateConverter(CPDFConvertType.CPDFConvertTypeWord,inputFilePath) as CPDFConverterWord;

7

8 // Set conversion options.

9 CPDFConvertWordOptions wordOptions = new CPDFConvertWordOptions();

10 wordOptions.IsAllowOCR = false;

11 wordOptions.IsContainAnnotations = true;

12 wordOptions.IsContainImages = true;

13 wordOptions.LayoutOpts = LayoutOptions.RetainPageLayout;

14 int pageCount = converter.GetPagesCount();

15 int[] pageArray = new int[pageCount];

16 for (int i = 0; i < pageArray.Length; i++)

17 {

18 pageArray[i] = i + 1;

19 }

20 // Convert PDF to Word.

21 ConvertError error = ConvertError.ERR_UNKNOWN;

22 converter.Convert(outputFolderPath, ref outputFileName, wordOptions, pageArray, ref error, getPorgress);

数据提取

1 string inputFilePath = "InputFile.pdf";

2 string outputFolderPath = "OutputFold";

3 string outputFileName = "OutputFile.json";

4

5 // Initialize data extraction instance.

6 CPDFConverterJsonText converter = CPDFConvertFactroy.CreateConverter(CPDFConvertType.CPDFConvertTypeJsonText, inputFilePath) as CPDFConverterJsonText;

7 // Set data extraction options.

8 CPDFConvertJsonOptions jsonOptions = new CPDFConvertJsonOptions();

9 jsonOptions.IsAllowOCR = false;

10 // Extract PDF data as Json.

11 ConvertError error = ConvertError.ERR_UNKNOWN;

12 jsonTextConverter.Convert(outputFolderPath, ref outputFileName, jsonOptions, ref error);

数字签名

1 // Load a document.

2 CPDFDocument document = CPDFDocument.InitWithFilePath("Test.pdf");

3

4 // Create a Signature Field.

5 CPDFPage page = document.PageAtIndex(0);

6 CPDFSignatureWidget signatureField = page.CreateWidget(C_WIDGET_TYPE.WIDGET_SIGNATUREFIELDS) as CPDFSignatureWidget;

7 signatureField.SetRect(new CRect(28, 420, 150, 370));

8 signatureField.SetWidgetBorderRGBColor(new byte[] { 0, 0, 0 })

9 signatureField.UpdateFormAp();

10

11 // Sign in the signature field.

12 CPDFSignatureCertificate certificate = CPDFPKCS12CertHelper.GetCertificateWithPKCS12Path("Certificate.pfx", "ComPDFKit");

13 CPDFSignatureConfig signatureConfig = new CPDFSignatureConfig

14 {

15 Text = certificate.SubjectDict["CN"],

16 Content = "Name: " + certificate.SubjectDict["CN"] + "\n" +

17  "Date: " + DateTime.Now.ToString("yyyy.MM.dd HH:mm:ss") + "\n" +

18 "Reason: " + "I am the owner of the document." + " \n" +

19 "Location: " + certificate.SubjectDict["C"] + "\n" +

20 "DN: " + certificate.Subject + "\n",

21 IsContentAlignLeft = false,

22 TextColor = new float[] { 0, 0, 0 },

23 ContentColor = new float[] { 0, 0, 0 }

24};

25 signatureField.UpdataApWithSignature(signatureConfig);

26

27 // Save the digital signature to the document.

28 document.WriteSignatureToFilePath(signatureField, document.FileName + "_Signed.pdf", "Certificate.pfx", "ComPDFKit", certificate.SubjectDict["C"], "I am the owner of the document.", CPDFSignaturePermissions.CPDFSignaturePermissionsNone);

您的全面 PDF 解决方案,满足所有需求

领先的 .NET PDF 库,用于生成和编辑 PDF。凭借其直观的 API,开发者可以快速处理批量 PDF。

兼容性

.NET 版本:

C#、VB.NET、F# 语言

.NET Core (8、7、6、5 和 2.1+)

.NET Standard (2.0+)

.NET Framework (4.5+)

.NET 项目类型:

Web (Blazor & WebForms)

桌面 (WPF & MAUI)

控制台 (App & Library)

应用环境:

Windows (7+, Server UI 2012+, Server Core 2022)

Linux (Ubuntu, Debian, CentOS, etc.)

Mac (macOS 10+)

Docker (Windows, Linux, Azure)

Azure (VPS, WebApp, Function)

AWS (EC2, Lambda)

IDEs:

Microsoft Visual Studio

JetBrains Rider & ReSharper

操作系统与处理器:

Windows, Mac, Linux

x64, x86, ARM

二进制认证:

DigiCert 签名的二进制文件

PDF 生成

net.compareDate.generation.office

Office 到 PDF

图像到 PDF

HTML 到 PDF

支持 PDF 标准:

net.compareDate.generation.version

PDF/UA (PDF/UA-1)

PDF/A (PDF/A-3b)

PDF 转换器

PDF 转换:

PDF 到 Word

PDF 到 Excel

PDF 到 PPT

PDF 到 HTML

PDF 到 CSV

PDF 到图像

PDF 到 RTF

PDF 到 TXT

数据提取

从 PDF 中提取文本

从 PDF 中提取表格

从 PDF 中提取图像

图像转换

图像到 PDF

图像到 Office

图像到 HTML

图像到 CSV

图像到 RTF

图像到 TXT

PDF 编辑

设置属性与安全性:

设置密码与权限

数字签名 (.pfx, .p12)

PDF 文件压缩

修订 PDF

编辑 PDF 元数据

编辑与签署修订历史

编辑文档结构:

添加、复制与删除页面

合并与拆分 PDF

注释

附件

书签与大纲

编辑页面内容:

绘制文本与位图

查找与替换文本

页眉与页脚

盖章文本与图像

自定义水印

背景与前景

贝茨编号

使用 PDF 表单:

创建与编辑表单

填写现有表单

查看、阅读与打印 PDF:

ComPDF 查看器

打印到物理打印机

导入与导出注释

END


公司名称:北京哲想软件有限公司

北京哲想软件官方网站:cogitosoft.com

北京哲想软件微信公众平台账号:cogitosoftware

北京哲想软件微博:哲想软件

北京哲想软件邮箱:sales@cogitosoft.com

销售(俞先生)联系方式:+86(010)68421378

微信:18610247936     QQ:368531638