Class PdfSecurity

Info

Mewakili plugin Documentize.PdfSecurity. Digunakan untuk Mengenkripsi, Mendekripsi, dan Menandatangani dokumen PDF.

public static class PdfSecurity

Inheritance

objectPdfSecurity

Inherited Members

Methods

Decrypt(DecryptOptions)

Mendekripsi dokumen PDF.

public static ResultContainer Decrypt(DecryptOptions options)

Parameters

  • options DecryptOptions: Objek opsi yang berisi instruksi untuk operasi.

Returns

ResultContainer : Objek yang berisi hasil operasi.

Examples

Contoh ini memperlihatkan cara Mendekripsi dokumen PDF.

// Create DecryptOptions object to set instructions
var options = new DecryptOptions("123456");
// Add input file path
options.AddInput(new FileData("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileData("path_to_result_pdf_file.pdf"));
// Perform the process
PdfSecurity.Decrypt(options);

Exceptions

ArgumentException

Jika opsi tidak disetel.

Encrypt(EncryptOptions)

Mengenkripsi dokumen PDF.

public static ResultContainer Encrypt(EncryptOptions options)

Parameters

  • options EncryptOptions: Objek opsi yang berisi instruksi untuk operasi.

Returns

ResultContainer : Objek yang berisi hasil operasi.

Examples

Contoh ini memperlihatkan cara Mengenkripsi dokumen PDF.

// Create EncryptOptions object to set instructions
var options = new EncryptOptions("123456", "qwerty");
// Add input file path
options.AddInput(new FileData("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileData("path_to_result_pdf_file.pdf"));
// Perform the process
PdfSecurity.Encrypt(options);

Exceptions

ArgumentException

Jika opsi tidak disetel.

Sign(SignOptions)

Menandatangani dokumen PDF dengan tanda tangan digital.

public static ResultContainer Sign(SignOptions options)

Parameters

  • options SignOptions: Objek opsi yang berisi instruksi untuk operasi.

Returns

ResultContainer : Objek yang berisi hasil operasi.

Examples

Contoh ini memperlihatkan cara Menandatangani dokumen PDF.

// Create SignOptions object to set instructions
var options = new SignOptions("path_to_your_pfx_file.pfx", "password_of_your_pfx_file");
// Add input file path
options.AddInput(new FileData("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileData("path_to_result_pdf_file.pdf"));
// Perform the process
PdfSecurity.Sign(options);

Contoh ini memperlihatkan cara Menandatangani dokumen PDF dengan Stream berkas PFX.

using var pfxStream = File.OpenRead(@"path_to_your_pfx_file.pfx");
var options = new SignOptions(pfxStream, "password_of_your_pfx_file");
options.AddInput(new FileData("path_to_your_pdf_file.pdf"));
options.AddOutput(new FileData("path_to_result_pdf_file.pdf"));
// Perform the process
PdfSecurity.Sign(options);

Contoh ini memperlihatkan cara Menandatangani dokumen PDF dengan tanda tangan tak terlihat.

var options = new SignOptions("path_to_your_pfx_file.pfx", "password_of_your_pfx_file");
options.AddInput(new FileData("path_to_your_pdf_file.pdf"));
options.AddOutput(new FileData("path_to_result_pdf_file.pdf"));
// Configure invisible signature
signOptions.Visible = false;
// Perform the process
PdfSecurity.Sign(options);

Contoh ini memperlihatkan cara Menandatangani dokumen PDF dengan opsi tambahan.

// Create SignOptions object to set instructions
var options = new SignOptions("path_to_your_pfx_file.pfx", "password_of_your_pfx_file");
// Add input file path
options.AddInput(new FileData("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileData("path_to_result_pdf_file.pdf"));
// Optional parameters
options.Reason = "my Reason";
options.Contact = "my Contact";
options.Location = "my Location";
options.PageNumber = 3;
// Perform the process
PdfSecurity.Sign(options);

Contoh ini memperlihatkan cara Menandatangani dokumen PDF dengan Timestamp.

// Create SignOptions object to set instructions
var options = new SignOptions("path_to_your_pfx_file.pfx", "password_for_your_pfx_file");
options.TimestampOptions = new TimestampOptions("server_url");
// Add input file path
options.AddInput(new FileData("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileData("path_to_result_pdf_file.pdf"));
// Perform the process
PdfSecurity.Sign(options);

Exceptions

ArgumentException

Jika opsi tidak disetel.

Namespace: Documentize Assembly: Documentize.dll

 Indonesia