Document metadata
PDF documents can include metadata describing the document’s title, the author, the program that created the document, and so on. Metadata can be customised by providing a PDFMetadata
object as the metadata
optional parameter of the SaveAsPDF
method.
The PDFMetadata
class defines the following properties:
string Title
: the title of the document. Default: empty.string Subject
: the subject of the document. Default: empty.string Author
: the name of the person who created the document. Default:Environment.UserName
.string Keywords
: keywords for the document. Default: empty.string Creator
: the program that created the document. Default:"VectSharp vX.Y.Z"
.string Producer
: the program that took the document and converted it to PDF format. Default:"VectSharp.PDF vX.Y.Z"
.DateTime CreationDate
: date of creation of the document, expressed locally to theCreationDateTimeZone
. Default:DateTime.Now
.TimeZoneInfo CreationDateTimeZone
: time zone for theCreationDate
. Default:TimeZoneInfo.Local
.DateTime ModificationDate
: date of the last modification of the document, expressed locally to theModificationDateTimeZone
. Default:DateTime.Now
.TimeZoneInfo ModificationDateTimeZone
: time zone for theModificationDate
. Default:TimeZoneInfo.Local
.Dictionary<string, object> CustomProperties
: you can use this dictionary to define custom document metadata properties. Default:null
.bool ExcludeMetadata
: if you do not wish to include any metadata in the document, set this totrue
. Default:false
.
The following example shows how to create a PDF document with customised metadata.
If you do not provide the metadata
parameter to the SaveAsPDF
method (or if it is set to null
), the default values are used. If you wish to explicitly exclude metadata from the document, you need to provide a PDFMetadata
object whose ExcludeMetadata
property is false
. The following example shows how to create a PDF document without any metadata.