Skip to content

PDFEncryptor

Namespace: O2S.Components.PDF4NET.Utilities

Utility class for fast encryption/decryption of PDF files.

public class PDFEncryptor

Inheritance ObjectPDFEncryptor

Methods

DecryptFile(String, String, String, Boolean)

Decrypts the PDF file given in input stream and saves the encrypted file to output stream.

public static void DecryptFile(string inputFileName, string inputPassword, string outputFileName, bool enableObjectCompression)

Parameters

inputFileName String
Path to the input PDF file.

inputPassword String
Password for decrypting the input file.

outputFileName String
Path to the decrypted PDF file.

enableObjectCompression Boolean
If true then the internal structure of the output PDF file is compressed.


DecryptFile(Stream, String, Stream, Boolean)

Decrypts the PDF file given in input stream and saves the encrypted file to output stream.

public static void DecryptFile(Stream input, string inputPassword, Stream output, bool enableObjectCompression)

Parameters

input Stream
Stream containing the input PDF file.

inputPassword String
Password for decrypting the input file.

output Stream
Stream for storing the decrypted PDF file.

enableObjectCompression Boolean
If true then the internal structure of the output PDF file is compressed.


EncryptFile(String, String, PDFSecurityHandler, Boolean)

Encrypts the input PDF file and saves the encrypted file to output path.

public static void EncryptFile(string inputFileName, string outputFileName, PDFSecurityHandler securityHandler, bool enableObjectCompression)

Parameters

inputFileName String
Path to the input PDF file.

outputFileName String
Path to the encrypted PDF file.

securityHandler PDFSecurityHandler
The security handler used for encryption.

enableObjectCompression Boolean
If true then the internal structure of the output PDF file is compressed.


EncryptFile(String, String, String, PDFSecurityHandler, Boolean)

Encrypts the input PDF file and saves the encrypted file to output path.

public static void EncryptFile(string inputFileName, string inputPassword, string outputFileName, PDFSecurityHandler securityHandler, bool enableObjectCompression)

Parameters

inputFileName String
Path to the input PDF file.

inputPassword String
Password for the input file if it is encrypted, othewise null.

outputFileName String
Path to the encrypted PDF file.

securityHandler PDFSecurityHandler
The security handler used for encryption.

enableObjectCompression Boolean
If true then the internal structure of the output PDF file is compressed.


EncryptFile(Stream, Stream, PDFSecurityHandler, Boolean)

Encrypts the PDF file given in input stream and saves the encrypted file to output stream.

public static void EncryptFile(Stream input, Stream output, PDFSecurityHandler securityHandler, bool enableObjectCompression)

Parameters

input Stream
Stream containing the input PDF file.

output Stream
Stream for storing the encrypted PDF file.

securityHandler PDFSecurityHandler
The security handler used for encryption.

enableObjectCompression Boolean
If true then the internal structure of the output PDF file is compressed.


EncryptFile(Stream, String, Stream, PDFSecurityHandler, Boolean)

Encrypts the PDF file given in input stream and saves the encrypted file to output stream.

public static void EncryptFile(Stream input, string inputPassword, Stream output, PDFSecurityHandler securityHandler, bool enableObjectCompression)

Parameters

input Stream
Stream containing the input PDF file.

inputPassword String
Password for the input file if it is encrypted, othewise null.

output Stream
Stream for storing the encrypted PDF file.

securityHandler PDFSecurityHandler
The security handler used for encryption.

enableObjectCompression Boolean
If true then the internal structure of the output PDF file is compressed.