public final class PdfEncryptor extends Object
Constructor and Description |
---|
PdfEncryptor() |
Modifier and Type | Method and Description |
---|---|
void |
encrypt(PdfReader reader,
OutputStream os)
Entry point to encrypt a PDF document.
|
static void |
encrypt(PdfReader reader,
OutputStream os,
EncryptionProperties properties)
Entry point to encrypt a PDF document.
|
static void |
encrypt(PdfReader reader,
OutputStream os,
EncryptionProperties properties,
Map<String,String> newInfo)
Entry point to encrypt a PDF document.
|
void |
encrypt(PdfReader reader,
OutputStream os,
Map<String,String> newInfo)
Entry point to encrypt a PDF document.
|
static byte[] |
getContent(com.itextpdf.commons.bouncycastle.cms.IRecipientInformation recipientInfo,
PrivateKey certificateKey,
String certificateKeyProvider)
Gets the content from a recipient.
|
static String |
getPermissionsVerbose(int permissions)
Give you a verbose analysis of the permissions.
|
static boolean |
isAssemblyAllowed(int permissions)
Tells you if document assembly is allowed.
|
static boolean |
isCopyAllowed(int permissions)
Tells you if copying is allowed.
|
static boolean |
isDegradedPrintingAllowed(int permissions)
Tells you if degraded printing is allowed.
|
static boolean |
isFillInAllowed(int permissions)
Tells you if filling in fields is allowed.
|
static boolean |
isModifyAnnotationsAllowed(int permissions)
Tells you if modifying annotations is allowed.
|
static boolean |
isModifyContentsAllowed(int permissions)
Tells you if modifying content is allowed.
|
static boolean |
isPrintingAllowed(int permissions)
Tells you if printing is allowed.
|
static boolean |
isScreenReadersAllowed(int permissions)
Tells you if repurposing for screenreaders is allowed.
|
PdfEncryptor |
setEncryptionProperties(EncryptionProperties properties)
Sets the
EncryptionProperties |
PdfEncryptor |
setEventCountingMetaInfo(com.itextpdf.commons.actions.contexts.IMetaInfo metaInfo)
Sets the
IMetaInfo that will be used during PdfDocument creation. |
public static void encrypt(PdfReader reader, OutputStream os, EncryptionProperties properties, Map<String,String> newInfo)
reader
- the read PDFos
- the output destinationproperties
- encryption properties. See EncryptionProperties
.newInfo
- an optional String
map to add or change
the info dictionary. Entries with null
values delete the key in the original info dictionarypublic static void encrypt(PdfReader reader, OutputStream os, EncryptionProperties properties)
reader
- the read PDFos
- the output destinationproperties
- encryption properties. See EncryptionProperties
.public static String getPermissionsVerbose(int permissions)
permissions
- the permissions value of a PDF filepublic static boolean isPrintingAllowed(int permissions)
permissions
- the permissions value of a PDF filepublic static boolean isModifyContentsAllowed(int permissions)
permissions
- the permissions value of a PDF filepublic static boolean isCopyAllowed(int permissions)
permissions
- the permissions value of a PDF filepublic static boolean isModifyAnnotationsAllowed(int permissions)
permissions
- the permissions value of a PDF filepublic static boolean isFillInAllowed(int permissions)
permissions
- the permissions value of a PDF filepublic static boolean isScreenReadersAllowed(int permissions)
permissions
- the permissions value of a PDF filepublic static boolean isAssemblyAllowed(int permissions)
permissions
- the permissions value of a PDF filepublic static boolean isDegradedPrintingAllowed(int permissions)
permissions
- the permissions value of a PDF filepublic static byte[] getContent(com.itextpdf.commons.bouncycastle.cms.IRecipientInformation recipientInfo, PrivateKey certificateKey, String certificateKeyProvider) throws com.itextpdf.commons.bouncycastle.cms.AbstractCMSException
recipientInfo
- recipient informationcertificateKey
- private certificate keycertificateKeyProvider
- the name of the certificate key providercom.itextpdf.commons.bouncycastle.cms.AbstractCMSException
- if the content cannot be recovered.public PdfEncryptor setEventCountingMetaInfo(com.itextpdf.commons.actions.contexts.IMetaInfo metaInfo)
IMetaInfo
that will be used during PdfDocument
creation.metaInfo
- meta info to setPdfEncryptor
instancepublic PdfEncryptor setEncryptionProperties(EncryptionProperties properties)
EncryptionProperties
properties
- the properties to setPdfEncryptor
instancepublic void encrypt(PdfReader reader, OutputStream os, Map<String,String> newInfo)
reader
- the read PDFos
- the output destinationnewInfo
- an optional String
map to add or change
the info dictionary. Entries with null
values delete the key in the original info dictionarypublic void encrypt(PdfReader reader, OutputStream os)
reader
- the read PDFos
- the output destinationCopyright © 1998–2023 Apryse Group NV. All rights reserved.