Class PdfEncryptor
This class takes any PDF and returns exactly the same but encrypted.
public sealed class PdfEncryptor
- Inheritance
-
PdfEncryptor
- Inherited Members
Remarks
This class takes any PDF and returns exactly the same but encrypted. All the content, links, outlines, etc, are kept. It is also possible to change the info dictionary.
Constructors
PdfEncryptor()
public PdfEncryptor()
Methods
Encrypt(PdfReader, Stream)
Entry point to encrypt a PDF document.
public void Encrypt(PdfReader reader, Stream os)
Parameters
Encrypt(PdfReader, Stream, IDictionary<string, string>)
Entry point to encrypt a PDF document.
public void Encrypt(PdfReader reader, Stream os, IDictionary<string, string> newInfo)
Parameters
reader
PdfReaderthe read PDF
os
Streamthe output destination
newInfo
IDictionary<string, string>an optional
String
map to add or change the info dictionary. Entries with null values delete the key in the original info dictionary
Encrypt(PdfReader, Stream, EncryptionProperties)
Entry point to encrypt a PDF document.
public static void Encrypt(PdfReader reader, Stream os, EncryptionProperties properties)
Parameters
reader
PdfReaderthe read PDF
os
Streamthe output destination
properties
EncryptionPropertiesencryption properties. See EncryptionProperties.
Encrypt(PdfReader, Stream, EncryptionProperties, IDictionary<string, string>)
Entry point to encrypt a PDF document.
public static void Encrypt(PdfReader reader, Stream os, EncryptionProperties properties, IDictionary<string, string> newInfo)
Parameters
reader
PdfReaderthe read PDF
os
Streamthe output destination
properties
EncryptionPropertiesencryption properties. See EncryptionProperties.
newInfo
IDictionary<string, string>an optional
String
map to add or change the info dictionary. Entries with null values delete the key in the original info dictionary
GetPermissionsVerbose(int)
Give you a verbose analysis of the permissions.
public static string GetPermissionsVerbose(int permissions)
Parameters
permissions
intthe permissions value of a PDF file
Returns
- string
a String that explains the meaning of the permissions value
IsAssemblyAllowed(int)
Tells you if document assembly is allowed.
public static bool IsAssemblyAllowed(int permissions)
Parameters
permissions
intthe permissions value of a PDF file
Returns
- bool
true if document assembly is allowed
IsCopyAllowed(int)
Tells you if copying is allowed.
public static bool IsCopyAllowed(int permissions)
Parameters
permissions
intthe permissions value of a PDF file
Returns
- bool
true if copying is allowed
IsDegradedPrintingAllowed(int)
Tells you if degraded printing is allowed.
public static bool IsDegradedPrintingAllowed(int permissions)
Parameters
permissions
intthe permissions value of a PDF file
Returns
- bool
true if degraded printing is allowed
IsFillInAllowed(int)
Tells you if filling in fields is allowed.
public static bool IsFillInAllowed(int permissions)
Parameters
permissions
intthe permissions value of a PDF file
Returns
- bool
true if filling in fields is allowed
IsModifyAnnotationsAllowed(int)
Tells you if modifying annotations is allowed.
public static bool IsModifyAnnotationsAllowed(int permissions)
Parameters
permissions
intthe permissions value of a PDF file
Returns
- bool
true if modifying annotations is allowed
IsModifyContentsAllowed(int)
Tells you if modifying content is allowed.
public static bool IsModifyContentsAllowed(int permissions)
Parameters
permissions
intthe permissions value of a PDF file
Returns
- bool
true if modifying content is allowed
IsPrintingAllowed(int)
Tells you if printing is allowed.
public static bool IsPrintingAllowed(int permissions)
Parameters
permissions
intthe permissions value of a PDF file
Returns
- bool
true if printing is allowed
IsScreenReadersAllowed(int)
Tells you if repurposing for screenreaders is allowed.
public static bool IsScreenReadersAllowed(int permissions)
Parameters
permissions
intthe permissions value of a PDF file
Returns
- bool
true if repurposing for screenreaders is allowed
SetEncryptionProperties(EncryptionProperties)
Sets the EncryptionProperties
public PdfEncryptor SetEncryptionProperties(EncryptionProperties properties)
Parameters
properties
EncryptionPropertiesthe properties to set
Returns
- PdfEncryptor
this PdfEncryptor instance
SetEventCountingMetaInfo(IMetaInfo)
Sets the iText.Commons.Actions.Contexts.IMetaInfo that will be used during PdfDocument creation.
public PdfEncryptor SetEventCountingMetaInfo(IMetaInfo metaInfo)
Parameters
metaInfo
IMetaInfometa info to set
Returns
- PdfEncryptor
this PdfEncryptor instance