public class WriterProperties extends Object
| Modifier and Type | Field and Description |
|---|---|
protected PdfAConformance |
addPdfAXmpMetadata |
protected PdfUAConformance |
addPdfUaXmpMetadata |
protected boolean |
addXmpMetadata |
protected int |
compressionLevel |
protected EncryptionProperties |
encryptionProperties |
protected PdfString |
initialDocumentId
The ID entry that represents the initial identifier.
|
protected Boolean |
isFullCompression
Indicates if to use full compression (using object streams).
|
protected PdfString |
modifiedDocumentId
The ID entry that represents a change in a document.
|
protected PdfVersion |
pdfVersion |
protected boolean |
smartMode
Indicates if the writer copy objects in a smart mode.
|
| Constructor and Description |
|---|
WriterProperties() |
| Modifier and Type | Method and Description |
|---|---|
WriterProperties |
addPdfAXmpMetadata(PdfAConformance aConformance)
Adds PDF/A XMP metadata to the PDF document.
|
WriterProperties |
addPdfUaXmpMetadata(PdfUAConformance uaConformance)
Adds PDF/UA XMP metadata to the PDF document.
|
WriterProperties |
addXmpMetadata()
If true, default XMPMetadata based on
PdfDocumentInfo will be added. |
WriterProperties |
setCompressionLevel(int compressionLevel)
Defines the level of compression for the document.
|
WriterProperties |
setFullCompressionMode(boolean fullCompressionMode)
Defines if full compression mode is enabled.
|
WriterProperties |
setInitialDocumentId(PdfString initialDocumentId)
The /ID entry of a document contains an array with two entries.
|
WriterProperties |
setModifiedDocumentId(PdfString modifiedDocumentId)
The /ID entry of a document contains an array with two entries.
|
WriterProperties |
setPdfVersion(PdfVersion version)
Defines pdf version for the created document.
|
WriterProperties |
setPublicKeyEncryption(Certificate[] certs,
int[] permissions,
int encryptionAlgorithm)
Sets the certificate encryption options for the document.
|
WriterProperties |
setPublicKeyEncryption(Certificate[] certs,
int[] permissions,
int encryptionAlgorithm,
MacProperties macProperties)
Sets the certificate encryption options for the document.
|
WriterProperties |
setStandardEncryption(byte[] userPassword,
byte[] ownerPassword,
int permissions,
int encryptionAlgorithm)
Sets the encryption options for the document.
|
WriterProperties |
setStandardEncryption(byte[] userPassword,
byte[] ownerPassword,
int permissions,
int encryptionAlgorithm,
MacProperties macProperties)
Sets the encryption options for the document.
|
WriterProperties |
useSmartMode()
Enables smart mode.
|
protected int compressionLevel
protected Boolean isFullCompression
protected boolean smartMode
protected boolean addXmpMetadata
protected PdfAConformance addPdfAXmpMetadata
protected PdfUAConformance addPdfUaXmpMetadata
protected PdfVersion pdfVersion
protected EncryptionProperties encryptionProperties
protected PdfString initialDocumentId
protected PdfString modifiedDocumentId
public WriterProperties setPdfVersion(PdfVersion version)
version - version for the document.WriterProperties instancepublic WriterProperties useSmartMode()
WriterProperties instancepublic WriterProperties addXmpMetadata()
PdfDocumentInfo will be added.
For PDF 2.0 documents, metadata will be added in any case.WriterProperties instancepublic WriterProperties addPdfAXmpMetadata(PdfAConformance aConformance)
This method calls addXmpMetadata() implicitly.
NOTE: Calling this method only affects the XMP metadata, but doesn't enable any additional checks that the created document meets all PDF/A requirements. When using this method make sure you are familiar with PDF/A document requirements. If you are not sure, use dedicated iText PDF/A module to create valid PDF/A documents.
aConformance - the PDF/A conformance which will be added to XMP metadataWriterProperties instancepublic WriterProperties addPdfUaXmpMetadata(PdfUAConformance uaConformance)
This method calls addXmpMetadata() implicitly.
NOTE: Calling this method only affects the XMP metadata, but doesn't enable any additional checks that the created document meets all PDF/UA requirements. When using this method make sure you are familiar with PDF/UA document requirements. If you are not sure, use dedicated iText PDF/UA module to create valid PDF/UA documents.
uaConformance - the PDF/UA conformance which will be added to XMP metadataWriterProperties instancepublic WriterProperties setCompressionLevel(int compressionLevel)
CompressionConstantscompressionLevel - CompressionConstants value.WriterProperties instancepublic WriterProperties setFullCompressionMode(boolean fullCompressionMode)
fullCompressionMode - true - to enable full compression mode, false to disable itWriterProperties instancepublic WriterProperties setStandardEncryption(byte[] userPassword, byte[] ownerPassword, int permissions, int encryptionAlgorithm)
userPassword - the user password. Can be null or of zero length, which is equal to
omitting the user passwordownerPassword - the owner password. If it's null or empty, iText will generate
a random string to be used as the owner passwordpermissions - the user permissions
The open permissions for the document can be
EncryptionConstants.ALLOW_PRINTING,
EncryptionConstants.ALLOW_MODIFY_CONTENTS,
EncryptionConstants.ALLOW_COPY,
EncryptionConstants.ALLOW_MODIFY_ANNOTATIONS,
EncryptionConstants.ALLOW_FILL_IN,
EncryptionConstants.ALLOW_SCREENREADERS,
EncryptionConstants.ALLOW_ASSEMBLY and
EncryptionConstants.ALLOW_DEGRADED_PRINTING.
The permissions can be combined by ORing themencryptionAlgorithm - the type of encryption. It can be one of
EncryptionConstants.STANDARD_ENCRYPTION_40,
EncryptionConstants.STANDARD_ENCRYPTION_128,
EncryptionConstants.ENCRYPTION_AES_128
or EncryptionConstants.ENCRYPTION_AES_256.
Optionally EncryptionConstants.DO_NOT_ENCRYPT_METADATA can be ORed
to output the metadata in cleartext.
EncryptionConstants.EMBEDDED_FILES_ONLY can be ORed as well.
Please be aware that the passed encryption types may override permissions:
EncryptionConstants.STANDARD_ENCRYPTION_40 implicitly sets
EncryptionConstants.DO_NOT_ENCRYPT_METADATA and
EncryptionConstants.EMBEDDED_FILES_ONLY as false;
EncryptionConstants.STANDARD_ENCRYPTION_128 implicitly sets
EncryptionConstants.EMBEDDED_FILES_ONLY as false;WriterProperties instancepublic WriterProperties setStandardEncryption(byte[] userPassword, byte[] ownerPassword, int permissions, int encryptionAlgorithm, MacProperties macProperties)
userPassword - the user password. Can be null or of zero length, which is equal to
omitting the user passwordownerPassword - the owner password. If it's null or empty, iText will generate
a random string to be used as the owner passwordpermissions - the user permissions
The open permissions for the document can be
EncryptionConstants.ALLOW_PRINTING,
EncryptionConstants.ALLOW_MODIFY_CONTENTS,
EncryptionConstants.ALLOW_COPY,
EncryptionConstants.ALLOW_MODIFY_ANNOTATIONS,
EncryptionConstants.ALLOW_FILL_IN,
EncryptionConstants.ALLOW_SCREENREADERS,
EncryptionConstants.ALLOW_ASSEMBLY and
EncryptionConstants.ALLOW_DEGRADED_PRINTING.
The permissions can be combined by ORing themencryptionAlgorithm - the type of encryption. It can be one of
EncryptionConstants.STANDARD_ENCRYPTION_40,
EncryptionConstants.STANDARD_ENCRYPTION_128,
EncryptionConstants.ENCRYPTION_AES_128
or EncryptionConstants.ENCRYPTION_AES_256.
Optionally EncryptionConstants.DO_NOT_ENCRYPT_METADATA can be ORed
to output the metadata in cleartext.
EncryptionConstants.EMBEDDED_FILES_ONLY can be ORed as well.
Please be aware that the passed encryption types may override permissions:
EncryptionConstants.STANDARD_ENCRYPTION_40 implicitly sets
EncryptionConstants.DO_NOT_ENCRYPT_METADATA and
EncryptionConstants.EMBEDDED_FILES_ONLY as false;
EncryptionConstants.STANDARD_ENCRYPTION_128 implicitly sets
EncryptionConstants.EMBEDDED_FILES_ONLY as false;macProperties - MacProperties class to configure MAC integrity protection properties.
Pass null if you want to disable MAC protection for any reasonWriterProperties instancepublic WriterProperties setPublicKeyEncryption(Certificate[] certs, int[] permissions, int encryptionAlgorithm)
certs - the public certificates to be used for the encryptionpermissions - the user permissions for each of the certificates
The open permissions for the document can be
EncryptionConstants.ALLOW_PRINTING,
EncryptionConstants.ALLOW_MODIFY_CONTENTS,
EncryptionConstants.ALLOW_COPY,
EncryptionConstants.ALLOW_MODIFY_ANNOTATIONS,
EncryptionConstants.ALLOW_FILL_IN,
EncryptionConstants.ALLOW_SCREENREADERS,
EncryptionConstants.ALLOW_ASSEMBLY and
EncryptionConstants.ALLOW_DEGRADED_PRINTING.
The permissions can be combined by ORing themencryptionAlgorithm - the type of encryption. It can be one of
EncryptionConstants.STANDARD_ENCRYPTION_40,
EncryptionConstants.STANDARD_ENCRYPTION_128,
EncryptionConstants.ENCRYPTION_AES_128
or EncryptionConstants.ENCRYPTION_AES_256.
Optionally EncryptionConstants.DO_NOT_ENCRYPT_METADATA can be ORed
to output the metadata in cleartext.
EncryptionConstants.EMBEDDED_FILES_ONLY can be ORed as well.
Please be aware that the passed encryption types may override permissions:
EncryptionConstants.STANDARD_ENCRYPTION_40 implicitly sets
EncryptionConstants.DO_NOT_ENCRYPT_METADATA and
EncryptionConstants.EMBEDDED_FILES_ONLY as false;
EncryptionConstants.STANDARD_ENCRYPTION_128 implicitly sets
EncryptionConstants.EMBEDDED_FILES_ONLY as false;WriterProperties instancepublic WriterProperties setPublicKeyEncryption(Certificate[] certs, int[] permissions, int encryptionAlgorithm, MacProperties macProperties)
certs - the public certificates to be used for the encryptionpermissions - the user permissions for each of the certificates
The open permissions for the document can be
EncryptionConstants.ALLOW_PRINTING,
EncryptionConstants.ALLOW_MODIFY_CONTENTS,
EncryptionConstants.ALLOW_COPY,
EncryptionConstants.ALLOW_MODIFY_ANNOTATIONS,
EncryptionConstants.ALLOW_FILL_IN,
EncryptionConstants.ALLOW_SCREENREADERS,
EncryptionConstants.ALLOW_ASSEMBLY and
EncryptionConstants.ALLOW_DEGRADED_PRINTING.
The permissions can be combined by ORing themencryptionAlgorithm - the type of encryption. It can be one of
EncryptionConstants.STANDARD_ENCRYPTION_40,
EncryptionConstants.STANDARD_ENCRYPTION_128,
EncryptionConstants.ENCRYPTION_AES_128
or EncryptionConstants.ENCRYPTION_AES_256.
Optionally EncryptionConstants.DO_NOT_ENCRYPT_METADATA can be ORed
to output the metadata in cleartext.
EncryptionConstants.EMBEDDED_FILES_ONLY can be ORed as well.
Please be aware that the passed encryption types may override permissions:
EncryptionConstants.STANDARD_ENCRYPTION_40 implicitly sets
EncryptionConstants.DO_NOT_ENCRYPT_METADATA and
EncryptionConstants.EMBEDDED_FILES_ONLY as false;
EncryptionConstants.STANDARD_ENCRYPTION_128 implicitly sets
EncryptionConstants.EMBEDDED_FILES_ONLY as false;macProperties - MacProperties class to configure MAC integrity protection properties.
Pass null if you want to disable MAC protection for any reasonWriterProperties instancepublic WriterProperties setInitialDocumentId(PdfString initialDocumentId)
initialDocumentId - the new initial document idWriterProperties instancepublic WriterProperties setModifiedDocumentId(PdfString modifiedDocumentId)
modifiedDocumentId - the new modified document idWriterProperties instanceCopyright © 1998–2024 Apryse Group NV. All rights reserved.