Class PdfSecurity

Information

Représente le plug-in Documentize.PdfSecurity. Utilisé pour chiffrer, déchiffrer et signer des documents PDF.

public static class PdfSecurity

Inheritance

objectPdfSecurity

Inherited Members

Methods

Decrypt(DecryptOptions)

Déchiffrer le document PDF.

public static ResultContainer Decrypt(DecryptOptions options)

Parameters

  • options DecryptOptions : Un objet d’options contenant les instructions pour l’opération.

Returns

ResultContainer : Un objet contenant le résultat de l’opération.

Examples

L’exemple montre comment déchiffrer un document 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

Si les options ne sont pas définies.

Encrypt(EncryptOptions)

Chiffrer le document PDF.

public static ResultContainer Encrypt(EncryptOptions options)

Parameters

  • options EncryptOptions : Un objet d’options contenant les instructions pour l’opération.

Returns

ResultContainer : Un objet contenant le résultat de l’opération.

Examples

L’exemple montre comment chiffrer le document 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

Si les options ne sont pas définies.

Sign(SignOptions)

Signer le document PDF par signature numérique.

public static ResultContainer Sign(SignOptions options)

Parameters

  • options SignOptions : Un objet d’options contenant les instructions pour l’opération.

Returns

ResultContainer : Un objet contenant le résultat de l’opération.

Examples

L’exemple montre comment signer le document 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);

L’exemple montre comment signer le document PDF avec un flux du fichier 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);

L’exemple montre comment signer le document PDF avec une signature invisible.

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);

L’exemple montre comment signer le document PDF avec des options supplémentaires.

// 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);

L’exemple montre comment signer le document PDF avec un horodatage.

// 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

Si les options ne sont pas définies.

Namespace : Documentize Assembly : Documentize.dll

 Français