PDF Mosaic: How to add/edit metadata in PDF file


Home       Features       Download       Tutorial       Version History       License       Source Code

 

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.

using PDFMosaic;
using System;
 
namespace DocumentInfo
{
    class DocumentInfo
    {
        static void Main()
        {
            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.Pages.Add(page);
 
            document.Save("DocumentInfo.pdf", true);
        }
    }
}

 


Home       Features       Download       Tutorial       Version History       License       Source Code