How to Change Metadata of a PDF Document

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

To access metadata of a PDF document, use PDFDocument.DocumentInfo property.


C# :

using PDFMosaic;
using System;

namespace DocumentInfo
  class DocumentInfo
    static void Main(string[] args)
      PDFDocument document = new PDFDocument();

      document.DocumentInfo.Subject = "Document Info";
      document.DocumentInfo.Title = "Custom title";
      document.DocumentInfo.Keywords = "pdf, PDFMosaic";
      document.DocumentInfo.Author = "PDF Mosaic";

      PDFPage page = new PDFPage(PDFPaperFormat.A4);
      PDFFont font = new PDFFont(PDFStandardFont.Helvetica, 16);
      PDFBrush brush = new PDFSolidBrush();
      page.Canvas.DrawString("Check document properties", font, brush, 100, 100);


      document.Save("DocumentInfo.pdf", true);


Visual Basic :

Imports PDFMosaic
Imports System

Module DocumentInfo
  Sub Main()
    Dim document As New PDFDocument()

    document.DocumentInfo.Subject = "Document Info"
    document.DocumentInfo.Title = "Custom title"
    document.DocumentInfo.Keywords = "pdf, PDFMosaic"
    document.DocumentInfo.Author = "PDF Mosaic"

    Dim page = New PDFPage(PDFPaperFormat.A4)
    Dim font As New PDFFont(PDFStandardFont.Helvetica, 16)
    Dim brush As New PDFSolidBrush()
    page.Canvas.DrawString("Check document properties", font, brush, 100, 100)


    document.Save("DocumentInfo.pdf", True)
  End Sub
End Module