How to use IronSecureDoc from C# in .NET

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を使用することで、DockerにホストされたソリューションであるIronSecureDoc APIと統合し、すべてのセキュリティプロセスをローカルに処理することで文書処理を安全かつ現場での運用を確保できます。

IronSecureDoc API はドキュメント管理のためにどんな機能を提供しますか?

IronSecureDoc API は、文書の暗号化、編集、デジタル署名などの機能を提供し、自己ホスト型環境内での安全な文書処理を容易にします。

デジタル署名でPDFドキュメントを認証するにはどうすればよいですか?

デジタル署名でPDFドキュメントを認証するには、CertifyAsync メソッドを使用し、認証ファイルのパスと必要なパスワードを提供します。

C#アプリケーションでPDFドキュメントを暗号化するにはどうすればよいですか?

C#アプリケーションでPDFドキュメントを暗号化するには、EncryptAsync メソッドを使用し、指定されたパスワードでドキュメントを安全にします。

PDF 文書内の特定の領域をレダクトすることは可能ですか?

はい、RedactRegionAsync メソッドを使用することで、編集したい領域の座標を指定し、PDF文書の中の特定の領域を編集することが可能です。

IronSecureDocクライアントを使用して問題が発生した場合はどうすればよいですか?

IronSecureDocクライアントを使用して問題が発生した場合、IronSoftwareのサポートチームにメール support@ironsoftware.com でお問い合わせください。

Curtis Chau
テクニカルライター

Curtis Chauは、カールトン大学でコンピュータサイエンスの学士号を取得し、Node.js、TypeScript、JavaScript、およびReactに精通したフロントエンド開発を専門としています。直感的で美しいユーザーインターフェースを作成することに情熱を持ち、Curtisは現代のフレームワークを用いた開発や、構造の良い視覚的に魅力的なマニュアルの作成を楽しんでいます。

開発以外にも、CurtisはIoT(Internet of Things)への強い関心を持ち、ハードウェアとソフトウェアの統合方法を模索しています。余暇には、ゲームをしたりDiscordボットを作成したりして、技術に対する愛情と創造性を組み合わせています。

準備はいいですか?
バージョン: 2024.10 ただ今リリースされました