iText 8.0.2 API
iText.Kernel.Pdf.WriterProperties Class Reference

Public Member Functions

virtual iText.Kernel.Pdf.WriterProperties  SetPdfVersion (PdfVersion version)
  Defines pdf version for the created document. More...
 
virtual iText.Kernel.Pdf.WriterProperties  UseSmartMode ()
  Enables smart mode. More...
 
virtual iText.Kernel.Pdf.WriterProperties  AddXmpMetadata ()
  If true, default XMPMetadata based on PdfDocumentInfo will be added. More...
 
virtual iText.Kernel.Pdf.WriterProperties  SetCompressionLevel (int compressionLevel)
  Defines the level of compression for the document. More...
 
virtual iText.Kernel.Pdf.WriterProperties  SetFullCompressionMode (bool fullCompressionMode)
  Defines if full compression mode is enabled. More...
 
virtual iText.Kernel.Pdf.WriterProperties  SetStandardEncryption (byte[] userPassword, byte[] ownerPassword, int permissions, int encryptionAlgorithm)
  Sets the encryption options for the document. More...
 
virtual iText.Kernel.Pdf.WriterProperties  SetPublicKeyEncryption (IX509Certificate[] certs, int[] permissions, int encryptionAlgorithm)
  Sets the certificate encryption options for the document. More...
 
virtual iText.Kernel.Pdf.WriterProperties  SetInitialDocumentId (PdfString initialDocumentId)
  The /ID entry of a document contains an array with two entries. More...
 
virtual iText.Kernel.Pdf.WriterProperties  SetModifiedDocumentId (PdfString modifiedDocumentId)
  The /ID entry of a document contains an array with two entries. More...
 
virtual iText.Kernel.Pdf.WriterProperties  AddUAXmpMetadata ()
  This method marks the document as PDF/UA and sets related flags is XMPMetaData. More...
 

Member Function Documentation

◆ AddUAXmpMetadata()

virtual iText.Kernel.Pdf.WriterProperties iText.Kernel.Pdf.WriterProperties.AddUAXmpMetadata ( )
inlinevirtual

This method marks the document as PDF/UA and sets related flags is XMPMetaData.

This method marks the document as PDF/UA and sets related flags is XMPMetaData. This method calls 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.

Returns
this WriterProperties instance

◆ AddXmpMetadata()

virtual iText.Kernel.Pdf.WriterProperties iText.Kernel.Pdf.WriterProperties.AddXmpMetadata ( )
inlinevirtual

If true, default XMPMetadata based on PdfDocumentInfo will be added.

If true, default XMPMetadata based on PdfDocumentInfo will be added. For PDF 2.0 documents, metadata will be added in any case.

Returns
this WriterProperties instance

◆ SetCompressionLevel()

virtual iText.Kernel.Pdf.WriterProperties iText.Kernel.Pdf.WriterProperties.SetCompressionLevel ( int  compressionLevel )
inlinevirtual

Defines the level of compression for the document.

Defines the level of compression for the document. See CompressionConstants

Parameters
compressionLevel

CompressionConstants value.

Returns
this WriterProperties instance

◆ SetFullCompressionMode()

virtual iText.Kernel.Pdf.WriterProperties iText.Kernel.Pdf.WriterProperties.SetFullCompressionMode ( bool  fullCompressionMode )
inlinevirtual

Defines if full compression mode is enabled.

Defines if full compression mode is enabled. If enabled, not only the content of the pdf document will be compressed, but also the pdf document inner structure.

Parameters
fullCompressionMode true - to enable full compression mode, false to disable it
Returns
this WriterProperties instance

◆ SetInitialDocumentId()

virtual iText.Kernel.Pdf.WriterProperties iText.Kernel.Pdf.WriterProperties.SetInitialDocumentId ( PdfString  initialDocumentId )
inlinevirtual

The /ID entry of a document contains an array with two entries.

The /ID entry of a document contains an array with two entries. The first one (initial id) represents the initial document id. It's a permanent identifier based on the contents of the file at the time it was originally created and does not change when the file is incrementally updated. To help ensure the uniqueness of file identifiers, it is recommend to be computed by means of a message digest algorithm such as MD5. iText will by default keep the existing initial id. But if you'd like you can set this id yourself using this setter.

Parameters
initialDocumentId the new initial document id
Returns
this WriterProperties instance

◆ SetModifiedDocumentId()

virtual iText.Kernel.Pdf.WriterProperties iText.Kernel.Pdf.WriterProperties.SetModifiedDocumentId ( PdfString  modifiedDocumentId )
inlinevirtual

The /ID entry of a document contains an array with two entries.

The /ID entry of a document contains an array with two entries. The second one (modified id) should be the same entry, unless the document has been modified. iText will by default generate a modified id. But if you'd like you can set this id yourself using this setter.

Parameters
modifiedDocumentId the new modified document id
Returns
this WriterProperties instance

◆ SetPdfVersion()

virtual iText.Kernel.Pdf.WriterProperties iText.Kernel.Pdf.WriterProperties.SetPdfVersion ( PdfVersion  version )
inlinevirtual

Defines pdf version for the created document.

Defines pdf version for the created document. Default value is PDF_1_7.

Parameters
version version for the document.
Returns
this WriterProperties instance

◆ SetPublicKeyEncryption()

virtual iText.Kernel.Pdf.WriterProperties iText.Kernel.Pdf.WriterProperties.SetPublicKeyEncryption ( IX509Certificate[]  certs,
int[]  permissions,
int  encryptionAlgorithm 
)
inlinevirtual

Sets the certificate encryption options for the document.

Sets the certificate encryption options for the document. An array of one or more public certificates must be provided together with an array of the same size for the permissions for each certificate.

Parameters
certs the public certificates to be used for the encryption
permissions 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 them
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. 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;
Returns
this WriterProperties instance

◆ SetStandardEncryption()

virtual iText.Kernel.Pdf.WriterProperties iText.Kernel.Pdf.WriterProperties.SetStandardEncryption ( byte[]  userPassword,
byte[]  ownerPassword,
int  permissions,
int  encryptionAlgorithm 
)
inlinevirtual

Sets the encryption options for the document.

Parameters
userPassword the user password. Can be null or of zero length, which is equal to omitting the user password
ownerPassword the owner password. If it's null or empty, iText will generate a random string to be used as the owner password
permissions 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 them
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. 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;
Returns
this WriterProperties instance

◆ UseSmartMode()

virtual iText.Kernel.Pdf.WriterProperties iText.Kernel.Pdf.WriterProperties.UseSmartMode ( )
inlinevirtual

Enables smart mode.

Enables smart mode.
In smart mode when resources (such as fonts, images,...) are encountered, a reference to these resources is saved in a cache, so that they can be reused. This requires more memory, but reduces the file size of the resulting PDF document.

Returns
this WriterProperties instance