暗号化
Documentize PDF Security for .NET は、暗号化、復号化、署名機能を提供し、PDF ドキュメントのセキュリティを強化する強力なツールです。機密情報が機密に保たれ、許可されていないアクセスから保護されます。
PDF を暗号化する方法
PDF ドキュメントを暗号化するには、次の手順に従います。
- ユーザー パスワードと所有者パスワードを設定した
EncryptOptions のインスタンスを作成 します。 AddInput メソッドで入力 PDF ファイルを追加 します。AddOutput メソッドで出力 PDF ファイルを追加 します。PdfSecurity クラスの Encrypt メソッドを使用して暗号化を実行 します。
1// Create EncryptOptions object to set instructions
2var options = new EncryptOptions("123456", "qwerty");
3// Add input file path
4options.AddInput(new FileData("path_to_your_pdf_file.pdf"));
5// Set output file path
6options.AddOutput(new FileData("path_to_result_pdf_file.pdf"));
7// Perform the process
8PdfSecurity.Encrypt(options);
主な機能:
- PDF ドキュメントの暗号化:ユーザー パスワードと所有者パスワードを設定して PDF ファイルを保護します。
- 自動化:暗号化および復号化を .NET アプリケーションに組み込んで、ワークフローを自動化できます。
- コンプライアンス:業界標準の文書セキュリティ要件を満たすようにドキュメントを保護します。
復号
The Documentize PDF Security for .NET is a powerful tool designed to enhance the security of your PDF documents by providing encryption, decryption and signing capabilities. It ensures that your sensitive information remains confidential and protected from unauthorized access.
PDF を復号する方法
- Create an instance of
DecryptionOptions with the necessary password. - Add the input PDF file using the
AddInput method. - Add the output PDF file using
AddOutput method. - Execute the encryption using the
Decrypt method of PdfSecurity class.
1// Create DecryptOptions object to set instructions
2var options = new DecryptOptions("123456");
3// Add input file path
4options.AddInput(new FileData("path_to_your_pdf_file.pdf"));
5// Set output file path
6options.AddOutput(new FileData("path_to_result_pdf_file.pdf"));
7// Perform the process
8PdfSecurity.Decrypt(options);
主な機能:
- Decrypt PDF Documents: Remove encryption from PDFs when needed.
- Automation: Integrate encryption and decryption into your .NET applications for automated workflows.
- Compliance: Ensure your documents meet industry standards for document security。
署名
The Documentize PDF Security for .NET component allows users to digitally sign PDF documents. It offers a streamlined process for adding signatures, ensuring authenticity, and securing PDF content. The component supports both visible and invisible signatures and provides options to customize the signature’s position, reason, contact information, and more.
How to Sign PDF Documents
To sign a PDF document using a PFX file, follow these steps:
- Instantiate the
SignOptions class with the PFX file path and password. - Add the input PDF and the output file to the options.
- Run the
Sign method to apply the signature.
1// Create SignOptions object to set instructions
2var options = new SignOptions("path_to_your_pfx_file.pfx", "password_of_your_pfx_file");
3// Add input file path
4options.AddInput(new FileData("path_to_your_pdf_file.pdf"));
5// Set output file path
6options.AddOutput(new FileData("path_to_result_pdf_file.pdf"));
7// Perform the process
8PdfSecurity.Sign(options);
How to Use Stream for PFX File
You can also sign a PDF using a PFX certificate provided as a stream instead of a file path. This allows more flexible handling of certificate storage.
1using var pfxStream = File.OpenRead(@"path_to_your_pfx_file.pfx");
2var options = new SignOptions(pfxStream, "password_of_your_pfx_file");
3options.AddInput(new FileData("path_to_your_pdf_file.pdf"));
4options.AddOutput(new FileData("path_to_result_pdf_file.pdf"));
5// Perform the process
6PdfSecurity.Sign(options);
How to Apply Invisible Signatures
To add an invisible signature (one that secures the document without displaying the signature on the document), simply set the Visible property to false.
- Create an instance of
SignOptions. - Set
Visible to false. - Add input and output files.
- Call
Sign to apply the invisible signature.
1var options = new SignOptions("path_to_your_pfx_file.pfx", "password_of_your_pfx_file");
2options.AddInput(new FileData("path_to_your_pdf_file.pdf"));
3options.AddOutput(new FileData("path_to_result_pdf_file.pdf"));
4// Configure invisible signature
5signOptions.Visible = false;
6// Perform the process
7PdfSecurity.Sign(options);
You can use extra options during adding signature to a PFX file like Reason, Contact, Location, PageNumber.
- Instantiate the
SignOptions class with the PFX file path and password. - Add the input PDF and the output file to the options.
- Set values for your options.
- Run the
Sign method to apply the signature.
1// Create SignOptions object to set instructions
2var options = new SignOptions("path_to_your_pfx_file.pfx", "password_of_your_pfx_file");
3// Add input file path
4options.AddInput(new FileData("path_to_your_pdf_file.pdf"));
5// Set output file path
6options.AddOutput(new FileData("path_to_result_pdf_file.pdf"));
7// Optional parameters
8options.Reason = "my Reason";
9options.Contact = "my Contact";
10options.Location = "my Location";
11options.PageNumber = 3;
12// Perform the process
13PdfSecurity.Sign(options);
How to Add a Timestamp to PDF
To add a secure timestamp to a PDF document, follow these steps:
- Create an instances of
TimestampOptions and SignOptions to configure the timestamping process. - Add the input PDF file using the
AddInput method. - Set the output file path using
AddOutput method. - Execute the timestamping using the
Sign method.
1var tOptions = new TimestampOptions("server_url");
2// Create SignOptions object to set Timestamp
3var options = new SignOptions(new TimestampOptions(tOptions));
4// Add input file path
5options.AddInput(new FileData("path_to_your_pdf_file.pdf"));
6// Set output file path
7options.AddOutput(new FileData("path_to_result_pdf_file.pdf"));
8// Perform the process
9PdfSecurity.Sign(options);
How to Use Custom Authentication with Timestamp Server
You can provide basic authentication credentials when connecting to the timestamp server. This allows you to authenticate with servers that require a username and password.
1// Configure the timestamping options with authentication
2var tOptions = new TimestampOptions("timestamp_server_url", "username:password");
Key Features:
- Digitally Sign PDF Documents: Secure your documents with visible or invisible digital signatures.
- PFX Support: Sign PDF files using a PFX certificate.
- Customizable Options: Configure signature settings like reason, location, and contact details.
- Visible and Invisible Signatures: Choose whether the signature is visible on the document.
- Customizable Timestamp Servers: Use custom timestamp server URLs and authentication credentials.
サニタイズ
Documentize PDF Security for .NET コンポーネントは、PDF ドキュメントをサニタイズする機能を提供します。メタデータ、添付ファイル、注釈、JavaScripts、フォーム、レイヤー、検索インデックス、またはプライベートコンテンツなどの機密または不要な情報を削除するためのシンプルなプロセスを実現します。コンポーネントは、削除する情報をカスタマイズできるオプションを提供します。
情報のクリア
- メタデータ
- 添付ファイル
- 注釈
- Java Scripts
- フォーム
- レイヤー
- 検索インデックス
PDF ドキュメントのサニタイズ方法
PDF ファイルをサニタイズするには、以下の手順を実行します。
- 入力ファイルパスと出力ファイルパスを指定して
SanitizeOptions クラスのインスタンスを作成します。 Sanitize メソッドを実行してサニタイズを適用します。
1// Create SanitizeOptions object to set input and output files
2var options = new SanitizeOptions("path_to_your_pdf_file.pdf", "path_to_result_pdf_file.pdf");
3// Perform the process
4PdfSecurity.Sanitize(options);
入出力データにストリームを使用する方法
ファイルパスを指定せず、ストリームとして提供された PDF ドキュメントでクリーニングを実行することもできます。
1// Prepare input and output streams
2using var inputStream = File.OpenRead("path_to_your_pdf_file.pdf");
3using var outputStream = new MemoryStream();
4// Create SanitizeOptions object to set input and output streams
5var options = new SanitizeOptions(inputStream, outputStream);
6// Perform the process
7PdfSecurity.Sanitize(options);
ファイルからストリームへのサニタイズ方法
入力と出力のデータタイプを組み合わせて設定できます。
1// Prepare output stream
2using var outputStream = new MemoryStream();
3// Create SanitizeOptions object to set input file and output stream
4var options = new SanitizeOptions("path_to_your_pdf_file.pdf", outputStream);
5// Perform the process
6PdfSecurity.Sanitize(options);
プロパティを使用したファイルからストリームへのサニタイズ方法
プロパティを使って入力と出力のデータタイプを設定できます。
1// Prepare output stream
2using var outputStream = new MemoryStream();
3// Create SanitizeOptions object
4var options = new SanitizeOptions();
5//Set Input file
6options.Input = new FileData("path_to_your_pdf_file.pdf");
7//Set Output stream
8options.Output = new StreamData(outputStream);
9// Perform the process
10PdfSecurity.Sanitize(options);
メタデータを削除せずにサニタイズする方法
RemoveMetadata プロパティを false に設定します。
1// Create SanitizeOptions object to set input and output files
2var options = new SanitizeOptions("path_to_your_pdf_file.pdf", "path_to_result_pdf_file.pdf");
3options.RemoveMetadata = false;
4// Perform the process
5PdfSecurity.Sanitize(options);
添付ファイルを削除せずにサニタイズする方法
RemoveAttachments プロパティを false に設定します。
1// Create SanitizeOptions object to set input and output files
2var options = new SanitizeOptions("path_to_your_pdf_file.pdf", "path_to_result_pdf_file.pdf");
3options.RemoveAttachments = false;
4// Perform the process
5PdfSecurity.Sanitize(options);
すべてのページを画像に変換し、結果の DPI を設定してサニタイズする方法
すべてのページを画像に変換し、結果の DPI を設定する例です。ConvertPagesToImages プロパティを true にし、必要に応じて ImageDpi を変更します。
1// Create SanitizeOptions object to set input and output files
2var options = new SanitizeOptions("path_to_your_pdf_file.pdf", "path_to_result_pdf_file.pdf");
3// Turn on conversion and set dpi
4options.ConvertPagesToImages = true;
5options.ImageDpi = 200;
6// Perform the process
7PdfSecurity.Sanitize(options);
JavaScripts と Actions を削除せずにサニタイズする方法
RemoveJavaScriptsAndActions プロパティを false に設定します。
1// Create SanitizeOptions object to set input and output files
2var options = new SanitizeOptions("path_to_your_pdf_file.pdf", "path_to_result_pdf_file.pdf");
3options.RemoveJavaScriptsAndActions = false;
4// Perform the process
5PdfSecurity.Sanitize(options);
最も簡潔な形式で PDF ファイルをサニタイズする方法
1PdfSecurity.Sanitize(new SanitizeOptions("path_to_your_pdf_file.pdf", "path_to_result_pdf_file.pdf"));
主な機能
- PDF ドキュメントのサニタイズ: 危険なデータを除去して文書をクリーンにします。
- カスタマイズ可能なオプション: 削除する項目と残す項目を選択できます。
- 画像への変換: ページを画像に変換しながら PDF として保持します。