PDF Properties Setting in C#, VB.NET

PDF Properties demonstrate a summary of one document, including Description, Security, Fonts, Custom and Advance. Users can set part of description according to document contents. This guide introduces a solution to set PDF properties in C# and VB.NET via Spire.PDF for .NET. The following screenshot shows result after setting properties.

Set PDF Properties

Spire.PDF for .NET, professional .NET PDF component, provides a DocumentInformation class. Users can set PDF properties through setting properties of this class. In this example, the set PDF properties include Author, Title, Producer and Keywords. So, assign appropriate values (string) for these properties according to document contents to set document properties. Download and install Spire.PDF for .NET and follow the code.

[C#]
using System;
using Spire.Pdf;

namespace PDFProperties
{
    class Properties
    {
        static void Main(string[] args)
        {
            PdfDocument document = new PdfDocument();
            document.LoadFromFile(@"E:\Work\Documents\PDF\Spire.PDF for .NET.pdf");

            document.DocumentInformation.Author = "E-iceblue";
            document.DocumentInformation.Title = "Spire.PDF for .NET Introduction";
            document.DocumentInformation.Producer = "Spire.PDF";
            document.DocumentInformation.Keywords = ".NET PDF, Spire.PDF for .NET";

            document.SaveToFile("properties.pdf");
            System.Diagnostics.Process.Start("properties.pdf");
        }
    }
}
[VB.NET]
Imports System
Imports Spire.Pdf

Namespace PDFProperties
    Friend Class Properties
        Shared Sub Main(ByVal args() As String)
            Dim document As New PdfDocument()
            document.LoadFromFile("E:\Work\Documents\PDF\Spire.PDF for .NET.pdf")

            document.DocumentInformation.Author = "E-iceblue"
            document.DocumentInformation.Title = "Spire.PDF for .NET Introduction"
            document.DocumentInformation.Producer = "Spire.PDF"
            document.DocumentInformation.Keywords = ".NET PDF, Spire.PDF for .NET"

            document.SaveToFile("properties.pdf")
            System.Diagnostics.Process.Start("properties.pdf")
        End Sub
    End Class
End Namespace

Spire.PDF, an easy-to-use PDF component, enables developers/programmers to generate, draw, modify and save PDF document for their .NET, Silverlight and WPF applications with C# and VB.NET.