Skip to content

PdfEncryptor.EncryptFile Method

Overloads

Name Description
EncryptFile(String,String,PdfSecurityHandler,Boolean) Encrypts the input PDF file and saves the encrypted file to output path.
EncryptFile(String,String,String,PdfSecurityHandler,Boolean) Encrypts the input PDF file and saves the encrypted file to output path.
EncryptFile(Stream,Stream,PdfSecurityHandler,Boolean) Encrypts the PDF file given in input stream and saves the encrypted file to output stream.
EncryptFile(Stream,String,Stream,PdfSecurityHandler,Boolean) Encrypts the PDF file given in input stream and saves the encrypted file to output stream.

EncryptFile(String,String,PdfSecurityHandler,Boolean)

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

C#
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.

C#
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.

C#
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.

C#
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.