Get and set document properties in C# and VB.NET

With GemBox.Pdf, you can get and set PDF files document properties (document information) in your C# or VB.NET application.

The following example shows how you can set PdfDocument.Info of an existing PDF document.

PDF document properties created with GemBox.Pdf C#/VB.NET library
Screenshot of PDF document properties set with GemBox.Pdf library
Upload your file (Drag file here)
using GemBox.Pdf;

class Program
{
    static void Main()
    {
        // If using Professional version, put your serial key below.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY");

        using (var document = PdfDocument.Load("%InputFileName%"))
        {
            // Get document properties.
            var info = document.Info;

            // Modify document properties.
            info.Title = "Document Properties Example";
            info.Author = "GemBox.Pdf";
            info.Subject = "Introduction to GemBox.Pdf";
            info.Keywords = "GemBox, Pdf, Examples";

            document.Save("Document Properties.pdf");
        }
    }
}
Imports GemBox.Pdf

Module Program

    Sub Main()

        ' If using Professional version, put your serial key below.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY")

        Using document = PdfDocument.Load("%InputFileName%")

            ' Get document properties.
            Dim info = document.Info

            ' Modify document properties.
            info.Title = "Document Properties Example"
            info.Author = "GemBox.Pdf"
            info.Subject = "Introduction to GemBox.Pdf"
            info.Keywords = "GemBox, Pdf, Examples"

            document.Save("Document Properties.pdf")
        End Using
    End Sub
End Module

See also


Next steps

GemBox.Pdf is a .NET component that enables developers to read, merge and split PDF files or execute low-level object manipulations from .NET applications in a simple and efficient way.

Download Buy