How to use IronSecureDoc from C# in .NET
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
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")
);
}
}
}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 ClassIronSecureDocClient
Explanation
IronSecureDocClientInitialization: Initialize theIronSecureDocClientwith the URL to yourIRONSECUREDOCserver.- 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
Frequently Asked Questions
What is IronSecureDoc used for?
IronSecureDoc is used to enhance document security by providing features such as PDF encryption, redaction, and digital signing within .NET applications.
How can I integrate IronSecureDoc into my .NET application?
You can integrate IronSecureDoc into your .NET application using the IronSoftware.SecureDoc.Client library, which allows seamless interaction with the IronSecureDoc API.
What features does IronSecureDoc offer for document security?
IronSecureDoc offers document encryption, redaction, digital signing, and secure processing within self-hosted environments to enhance data protection.
Where can I find the IronSecureDoc NuGet package?
The IronSecureDoc NuGet package can be found on the official NuGet website at https://www.nuget.org/packages/IronSoftware.SecureDoc.Client.
How do I connect to the IronSecureDoc server using the client library?
You can connect to the IronSecureDoc server by initializing the IronSecureDocClient with your server's URL and using the TryConnectAsync() method to verify the connection.
How is text redaction handled in IronSecureDoc?
Text redaction is handled through the RedactTextAsync method, where you define sensitive words or phrases you want to redact in the document.
Can IronSecureDoc certify documents, and how?
Yes, IronSecureDoc can certify documents using the CertifyAsync method, where you provide the path to your certification file and password.
What method is used to encrypt documents in IronSecureDoc?
The EncryptAsync method is used to secure a document by encrypting it with a specified password.
Is it possible to redact specific regions in a document with IronSecureDoc?
Yes, specific regions in a document can be redacted by specifying coordinates using the RedactRegionAsync method.
How can I receive support for using IronSecureDoc?
For support with IronSecureDoc, you can contact the support team via email at support@ironsoftware.com.

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.