'' This code is part of Document Solutions for PDF demos.
'' Copyright (c) MESCIUS inc. All rights reserved.
Imports System.IO
Imports System.Drawing
Imports GrapeCity.Documents.Pdf
Imports GrapeCity.Documents.Text

'' Shows how to set various document properties such as PDF version, document info And metadata.
Public Class DocProperties
    Sub CreatePDF(ByVal stream As Stream)
        '' Create a new PDF document:
        Dim doc = New GcPdfDocument()
        '' While normally the PDF Version written into the document is determined automatically
        '' (as the minimal version needed for the features actually used in this document),
        '' it can be explicitly set:
        doc.PdfVersion = "1.7"
        '' By default, GcPdfDocument uses compression level 6 to reduce the file size.
        '' Setting the level to 0 will result in uncompressed PDF:
        doc.CompressionLevel = 0
        '' By default, font subsets containing just the glyphs used in the document,
        '' are embedded. This can be changed to embed whole fonts (which may result in
        '' huge file size) or to not embed fonts as we do here (embedding can also
        '' be controlled for individual fonts using the GcPdfDocument.Fonts collection):
        doc.FontEmbedMode = FontEmbedMode.NotEmbed
        '' Document properties such as title, author etc. can be set on GcPdfDocument.DocumentInfo,
        '' but it should be noted that similar properties can be set in the GcPdfDocument.Metadata
        '' and in most PDF readers properties set in metadata (see below) take precedence.
        '' Here we set some of the properties available in DocumentInfo:
        doc.DocumentInfo.Title = "DsPdf Document Info Sample"
        doc.DocumentInfo.Author = "Jaime Smith"
        doc.DocumentInfo.Subject = "GcPdfDocument.DocumentInfo"
        doc.DocumentInfo.Producer = "DsPdfWeb Producer"
        doc.DocumentInfo.Creator = "DsPdfWeb Creator"
        '' For sample sake, set CreationDate to a date 10 years in the future:
        doc.DocumentInfo.CreationDate = Util.TimeNow().AddYears(10)
        '' Document metadata is available via the GcPdfDocument.Metadata property.
        '' It provides a number of predefined accessors, such as:
        doc.Metadata.Contributors.Add("contributor 1")
        doc.Metadata.Contributors.Add("contributor 2")
        doc.Metadata.Contributors.Add("contributor 3")
        doc.Metadata.Copyright = "MESCIUS inc."
        doc.Metadata.Creators.Add("Creator 1")
        doc.Metadata.Creators.Add("Creator 2")
        doc.Metadata.Creators.Add("Creator 3")
        doc.Metadata.Description = "Sample document description"
        doc.Metadata.Source = "Sourced by DsPdfWeb"
        '' Arbitrary metadata can also be added using the AddProperty method:
        doc.Metadata.AddProperty("", "language", "English")
        '' Finally, add a page and some text to the document and save it:
        Util.AddNote("DsPdf Document Properties sample.", doc.NewPage())

        '' Done:
    End Sub
End Class