public class WriterProperties extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
protected boolean |
addUAXmpMetadata |
protected boolean |
addXmpMetadata |
protected int |
compressionLevel |
protected boolean |
debugMode |
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 |
addUAXmpMetadata()
This method marks the document as PDF/UA and sets related flags is XMPMetaData.
|
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 |
setStandardEncryption(byte[] userPassword, byte[] ownerPassword, int permissions, int encryptionAlgorithm)
Sets the encryption options for the document.
|
WriterProperties |
useDebugMode()
This activates debug mode with pdfDebug tool.
|
WriterProperties |
useSmartMode()
Enables smart mode.
|
protected int compressionLevel
protected Boolean isFullCompression
protected boolean smartMode
protected boolean debugMode
protected boolean addXmpMetadata
protected boolean addUAXmpMetadata
protected PdfVersion pdfVersion
protected EncryptionProperties encryptionProperties
protected PdfString initialDocumentId
protected PdfString modifiedDocumentId
public WriterProperties setPdfVersion(PdfVersion version)
version
- version for the document.
WriterProperties
instance
public WriterProperties useSmartMode()
WriterProperties
instance
public WriterProperties addXmpMetadata()
PdfDocumentInfo
will be added. For PDF 2.0 documents, metadata will be added in any case.
WriterProperties
instance
public WriterProperties setCompressionLevel(int compressionLevel)
CompressionConstants
compressionLevel
- CompressionConstants
value.
WriterProperties
instance
public WriterProperties setFullCompressionMode(boolean fullCompressionMode)
fullCompressionMode
- true - to enable full compression mode, false to disable it
WriterProperties
instance
public WriterProperties setStandardEncryption(byte[] userPassword, byte[] ownerPassword, int permissions, int encryptionAlgorithm)
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 them.
userPassword
- the user password. Can be null or empty
ownerPassword
- the owner password. Can be null or empty
permissions
- the user permissions
encryptionAlgorithm
- 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
WriterProperties
instance
public WriterProperties setPublicKeyEncryption(Certificate[] certs, int[] permissions, int encryptionAlgorithm)
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 them.
certs
- the public certificates to be used for the encryption
permissions
- the user permissions for each of the certificates
encryptionAlgorithm
- 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
WriterProperties
instance
public WriterProperties setInitialDocumentId(PdfString initialDocumentId)
initialDocumentId
- the new initial document id
WriterProperties
instance
public WriterProperties setModifiedDocumentId(PdfString modifiedDocumentId)
modifiedDocumentId
- the new modified document id
WriterProperties
instance
public WriterProperties useDebugMode()
WriterProperties
instance
public WriterProperties addUAXmpMetadata()
addXmpMetadata()
implicitly. NOTE: iText does not validate PDF/UA, which means we don't check if created PDF meets all PDF/UA requirements. Don't use this method if you are not familiar with PDF/UA specification in order to avoid creation of non-conformant PDF/UA file.
WriterProperties
instance
Copyright © 1998–2018 iText Group NV. All rights reserved.