IronSecureDoc 教程 在 C# .NET 中设置 How to use IronSecureDoc from C# in .NET Curtis Chau 已更新:六月 12, 2025 Download IronSecureDoc 免费下载 Start Free Trial Copy for LLMs Copy for LLMs Copy page as Markdown for LLMs Open in ChatGPT Ask ChatGPT about this page Open in Gemini Ask Gemini about this page Open in Grok Ask Grok about this page Open in Perplexity Ask Perplexity about this page Share Share on Facebook Share on X (Twitter) Share on LinkedIn Copy URL Email article This article was translated from English: Does it need improvement? Translated View the article in English Your Gateway to Enhanced Document Security IronSoftware.SecureDoc.Client is a robust client-side library designed to interact seamlessly with the IronSecureDoc API, a comprehensive document security solution hosted in a Docker container. This client library facilitates easy integration into your existing .NET applications, enabling you to leverage the powerful features of IronSecureDoc, including PDF encryption, redaction, and digital signing, all through simple REST API calls. With IronSoftware.SecureDoc.Client, developers can ensure the security and integrity of documents within their applications, maintaining all operations on-site for enhanced data protection. Whether you need to redact sensitive information, certify documents with digital signatures, or enforce document encryption, IronSoftware.SecureDoc.Client provides the necessary tools to accomplish these tasks efficiently and securely. Features Key Features: Easy integration with IronSecureDoc's REST API. Support for document encryption, redaction, and digital signing. Facilitates secure document processing within self-hosted environments. Enhances data protection by keeping document security operations on-site. Compatible with .NET applications, offering a straightforward approach to secure document management. Installation Let's start with installing the NuGet package from the package manager: Option 1: Download from NuGet The NuGet package is listed here on the official NuGet website: https://www.nuget.org/packages/IronSoftware.SecureDoc.Client Option 2: PM Install Command Install-Package IronSoftware.SecureDoc.Client Code Example using IronSecureDoc; using System.IO; using System.Threading.Tasks; // Example illustrating how to use the IronSecureDocClient class SecureDocExample { static async Task Main(string[] args) { // Replace with your IRONSECUREDOC URL var client = new IronSecureDocClient("http://localhost:5185"); // Replace with your PDF or CERT paths string PDF_PATH = "path/to/your.pdf"; string CERT_PATH = "path/to/your.p12"; // Attempt to connect to the IronSecureDoc API if (await client.TryConnectAsync()) { // Redact Text File.WriteAllBytes( "redact_text_example.pdf", await client.RedactTextAsync(PDF_PATH, new[] { "Dummy" }) ); // Redact Region File.WriteAllBytes( "redact_region_example.pdf", await client.RedactRegionAsync(PDF_PATH, 50, 50, 200, 100) ); // Certify File.WriteAllBytes( "certify_example.pdf", await client.CertifyAsync(PDF_PATH, CERT_PATH, "123456", CertifyPermissions.FormFillingAllowed) ); // Encrypt File.WriteAllBytes( "encrypt_example.pdf", await client.EncryptAsync(PDF_PATH, "iron") ); } } } using IronSecureDoc; using System.IO; using System.Threading.Tasks; // Example illustrating how to use the IronSecureDocClient class SecureDocExample { static async Task Main(string[] args) { // Replace with your IRONSECUREDOC URL var client = new IronSecureDocClient("http://localhost:5185"); // Replace with your PDF or CERT paths string PDF_PATH = "path/to/your.pdf"; string CERT_PATH = "path/to/your.p12"; // Attempt to connect to the IronSecureDoc API if (await client.TryConnectAsync()) { // Redact Text File.WriteAllBytes( "redact_text_example.pdf", await client.RedactTextAsync(PDF_PATH, new[] { "Dummy" }) ); // Redact Region File.WriteAllBytes( "redact_region_example.pdf", await client.RedactRegionAsync(PDF_PATH, 50, 50, 200, 100) ); // Certify File.WriteAllBytes( "certify_example.pdf", await client.CertifyAsync(PDF_PATH, CERT_PATH, "123456", CertifyPermissions.FormFillingAllowed) ); // Encrypt File.WriteAllBytes( "encrypt_example.pdf", await client.EncryptAsync(PDF_PATH, "iron") ); } } } Imports IronSecureDoc Imports System.IO Imports System.Threading.Tasks ' Example illustrating how to use the IronSecureDocClient Friend Class SecureDocExample Shared Async Function Main(ByVal args() As String) As Task ' Replace with your IRONSECUREDOC URL Dim client = New IronSecureDocClient("http://localhost:5185") ' Replace with your PDF or CERT paths Dim PDF_PATH As String = "path/to/your.pdf" Dim CERT_PATH As String = "path/to/your.p12" ' Attempt to connect to the IronSecureDoc API If Await client.TryConnectAsync() Then ' Redact Text File.WriteAllBytes("redact_text_example.pdf", Await client.RedactTextAsync(PDF_PATH, { "Dummy" })) ' Redact Region File.WriteAllBytes("redact_region_example.pdf", Await client.RedactRegionAsync(PDF_PATH, 50, 50, 200, 100)) ' Certify File.WriteAllBytes("certify_example.pdf", Await client.CertifyAsync(PDF_PATH, CERT_PATH, "123456", CertifyPermissions.FormFillingAllowed)) ' Encrypt File.WriteAllBytes("encrypt_example.pdf", Await client.EncryptAsync(PDF_PATH, "iron")) End If End Function End Class $vbLabelText $csharpLabel Explanation IronSecureDocClient Initialization: Initialize the IronSecureDocClient with the URL to your IRONSECUREDOC server. Connecting: Use TryConnectAsync() to verify the connection to the server. Redact Text: Define sensitive words/phrases to redact using RedactTextAsync. Redact Region: Redact specific regions by specifying coordinates with RedactRegionAsync. Certify: Add a digital certification with CertifyAsync. Provide path to the certification file and a password. Encrypt: Secure the document by encrypting it using EncryptAsync. Support For support please contact us: support@ironsoftware.com 常见问题解答 如何在我的 .NET 应用程序中集成文档安全功能? 您可以通过使用 IronSoftware.SecureDoc.Client 库集成文档安全功能。这允许您通过 REST API 调用执行 PDF 加密、编辑和数字签名等操作。 在 C# 项目中安装 IronSecureDoc 客户端涉及哪些步骤? 要在 C# 项目中安装 IronSecureDoc 客户端,您可以从 NuGet 下载 IronSoftware.SecureDoc.Client 包或使用包管理器命令:Install-Package IronSoftware.SecureDoc.Client。 我可以用这个解决方案在 PDF 文档中执行文本编辑吗? 是的,您可以使用 RedactTextAsync 方法在 PDF 文档中执行文本编辑,这可以让您指定要编辑的单词或短语。 如何确保我的文档操作保持安全且在现场进行? 使用 IronSecureDoc 通过与 IronSecureDoc API 集成保持文档操作的安全性和本地化。这是一个 Docker 托管的解决方案,可确保所有安全过程在本地处理。 IronSecureDoc API 提供了哪些文档管理功能? IronSecureDoc API 提供了文档加密、编辑、数字签名等功能,并有助于在自托管环境中进行安全的文档处理。 如何使用数字签名认证 PDF 文档? 要使用数字签名认证 PDF 文档,请使用 CertifyAsync 方法,提供您的认证文件路径和必要的密码。 如何在我的 C# 应用程序中加密 PDF 文档? 您可以在 C# 应用程序中使用 EncryptAsync 方法加密 PDF 文档,该方法使用指定的密码安全地加密文档。 在 PDF 文档中,能否编辑特定区域? 是的,可以通过使用 RedactRegionAsync 方法编辑 PDF 文档中的特定区域,该方法要求您指定要编辑的区域坐标。 使用 IronSecureDoc 客户端时遇到问题怎么办? 如果您在使用 IronSecureDoc 客户端时遇到问题,可以通过发送电子邮件至support@ironsoftware.com 联系 IronSoftware 的支持团队获取帮助。 Curtis Chau 立即与工程团队聊天 技术作家 Curtis Chau 拥有卡尔顿大学的计算机科学学士学位,专注于前端开发,精通 Node.js、TypeScript、JavaScript 和 React。他热衷于打造直观且美观的用户界面,喜欢使用现代框架并创建结构良好、视觉吸引力强的手册。除了开发之外,Curtis 对物联网 (IoT) 有浓厚的兴趣,探索将硬件和软件集成的新方法。在空闲时间,他喜欢玩游戏和构建 Discord 机器人,将他对技术的热爱与创造力相结合。 准备开始了吗? 版本: 2024.10 刚刚发布 免费下载 查看许可证