Document metadata

Docotic.Pdf Library Help > Samples > Metadata > Document metadata
Docotic.Pdf documentation

This sample shows how to change metadata of a PDF document (properties such as "Author", "Title") using PdfInfo class.

To access metadata of a PDF document, use PdfDocument.Info property.

C# 
using System.Diagnostics;

namespace BitMiracle.Docotic.Pdf.Samples
{
    public static class Metadata
    {
        public static void Main()
        {
            // NOTE: 
            // When used in trial mode, the library imposes some restrictions.
            // Please visit http://bitmiracle.com/pdf-library/trial-restrictions.aspx
            // for more information.

            string pathToFile = "Metadata.pdf";

            using (PdfDocument pdf = new PdfDocument())
            {
                pdf.Info.Author = "Sample Browser application";
                pdf.Info.Subject = "Document metadata";
                pdf.Info.Title = "Custom title goes here";
                pdf.Info.Keywords = "pdf, Docotic.Pdf";

                PdfPage page = pdf.Pages[0];
                page.Canvas.DrawString(10, 50, "Check document properties");

                pdf.Save(pathToFile);
            }

            Process.Start(pathToFile);
        }
    }
}
Visual Basic 
Imports System.Diagnostics

Imports BitMiracle.Docotic.Pdf

Namespace BitMiracle.Docotic.Pdf.Samples
    Public NotInheritable Class Metadata
        Public Shared Sub Main()
            ' NOTE: 
            ' When used in trial mode, the library imposes some restrictions.
            ' Please visit http://bitmiracle.com/pdf-library/trial-restrictions.aspx
            ' for more information.

            Dim pathToFile As String = "Metadata.pdf"

            Using pdf As New PdfDocument()

                pdf.Info.Author = "Sample Browser application"
                pdf.Info.Subject = "Document metadata"
                pdf.Info.Title = "Custom title goes here"
                pdf.Info.Keywords = "pdf, Docotic.Pdf"

                Dim page As PdfPage = pdf.Pages(0)
                page.Canvas.DrawString(10, 50, "Check document properties")

                pdf.Save(pathToFile)
            End Using

            Process.Start(pathToFile)
        End Sub
    End Class
End Namespace