IRONSOFTWAREHOME

How to Set and Edit PDF Metadata in C# with IronPDF

Curtis Chau
Curtis Chau
Updated: August 2, 2026

IronPDF enables developers to programmatically set and edit PDF metadata in C# applications, including standard properties like title, author, and keywords, as well as custom metadata fields for enhanced document organization and searchability. Whether you're building business applications that require document tracking, implementing compliance features, or organizing your PDF library, IronPDF provides comprehensive metadata manipulation capabilities. This functionality integrates seamlessly with IronPDF's HTML to PDF conversion and other document processing features.

Quickstart: Modify PDF Metadata Instantly

Manage PDF metadata using IronPDF with just a few lines of code. Load your PDF, update metadata such as title, author, or keywords, and save your changes. This guide simplifies setting and editing metadata, ensuring your documents are well-organized and searchable. Enhance your PDF capabilities by following this straightforward approach.

  1. 1Install IronPDF with NuGet Package Manager

    PM > Install-Package IronPdf

  2. 2Copy and run this code snippet.

    var pdf = IronPdf.PdfDocument.FromFile("example.pdf");
    pdf.MetaData.Title = "MyDoc";
    pdf.MetaData.Author = "Me";
    pdf.MetaData.Subject = "Demo";
    pdf.MetaData.Keywords = "ironpdf,metadata";
    pdf.MetaData.Creator = "MyApp";
    pdf.MetaData.Producer = "IronPDF";
    pdf.MetaData.CreationDate = DateTime.Today;
    pdf.MetaData.ModifiedDate = DateTime.Now;
    pdf.SaveAs("updated_example.pdf");
    C#
  3. 3Deploy to test on your live environment

    Start using IronPDF in your project today with a free trial
    arrow pointer

How Do I Set and Edit PDF Metadata?

When using IronPDF, setting and editing generic metadata fields in PDFs is straightforward. Access the MetaData property to modify available metadata fields. This functionality is particularly useful when working with PDF forms, digital signatures, or implementing document management systems.

using IronPdf;
using System;

ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>Metadata</h1>");

// Access the MetaData class and set the pre-defined metadata properties.
pdf.MetaData.Author = "Iron Software";
pdf.MetaData.CreationDate = DateTime.Today;
pdf.MetaData.Creator = "IronPDF";
pdf.MetaData.Keywords = "ironsoftware,ironpdf,pdf";
pdf.MetaData.ModifiedDate = DateTime.Now;
pdf.MetaData.Producer = "IronPDF";
pdf.MetaData.Subject = "Metadata Tutorial";
pdf.MetaData.Title = "IronPDF Metadata Tutorial";

pdf.SaveAs("pdf-with-metadata.pdf");

How Can I View the Metadata in the Output PDF?

To view document metadata, click on the three vertical dots and access Document properties. This metadata is crucial for document organization, especially when implementing PDF/A compliant documents for long-term archival.

How Do I Set and Retrieve the Metadata Dictionary?

The GetMetaDataDictionary method retrieves the existing metadata dictionary and accesses metadata information stored within the document. The SetMetaDataDictionary method provides an effective way to rewrite the metadata dictionary. If a key is not present in generic metadata fields, it becomes a custom metadata property. This approach is particularly useful when working with merging multiple PDFs and consolidating metadata from different sources.

using IronPdf;
using System.Collections.Generic;

ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>Metadata</h1>");

Dictionary<string, string> newMetadata = new Dictionary<string, string>();
newMetadata.Add("Title", "How to article");
newMetadata.Add("Author", "IronPDF");

// Set metadata dictionary
pdf.MetaData.SetMetaDataDictionary(newMetadata);

// Retreive metadata dictionary
Dictionary<string, string> metadataProperties = pdf.MetaData.GetMetaDataDictionary();

What Happens When I Use the Metadata Dictionary?

To view document metadata, click on the three vertical dots and access Document properties. The metadata dictionary approach is especially helpful when implementing batch processing workflows or standardizing metadata across multiple documents. For advanced document management scenarios, consider combining this with PDF compression techniques to optimize file storage.

Working with Metadata in Different Contexts

When developing enterprise applications, metadata plays a crucial role in document classification and retrieval. Here's an example of implementing a comprehensive metadata management system:

using IronPdf;
using System;
using System.Collections.Generic;

public class PDFMetadataManager
{
    public static void ProcessBatchMetadata(List<string> pdfPaths)
    {
        foreach (string path in pdfPaths)
        {
            var pdf = PdfDocument.FromFile(path);
            
            // Standardize metadata across all documents
            pdf.MetaData.Producer = "Company Document System v2.0";
            pdf.MetaData.Creator = "IronPDF";
            
            // Add processing timestamp
            pdf.MetaData.ModifiedDate = DateTime.Now;
            
            // Add document classification
            var metadata = pdf.MetaData.GetMetaDataDictionary();
            metadata["DocumentType"] = "Internal Report";
            metadata["Department"] = "Finance";
            metadata["SecurityLevel"] = "Confidential";
            
            pdf.MetaData.SetMetaDataDictionary(metadata);
            pdf.SaveAs(path.Replace(".pdf", "_processed.pdf"));
        }
    }
}

My favorite library of this kind is IronPDF. It allows for fast and efficient manipulation of PDF files. It also has many valuable features, like exporting to PDF/A format and digitally signing PDF documents.

Milan Jovanovic

Microsoft MVP

View case study

IronOCR means we can save $40,000 annually from manual processing, while enhancing productivity and freeing up resources for high-impact tasks. I would highly recommend it.

Brent Matzelle

Chief Technology Officer, OPYN

View case study

The IronSuite play a crucial role in our operations. These are tools that increase efficiencies across the business including creating floor plans and improving inventory management.

David Jones

Lead Software Engineer, Agorus Build

View case study

How Do I Add, Edit, and Remove Custom Metadata?

In addition to standard metadata of a PDF document, you can include custom metadata properties. These custom properties are often not visible in PDF viewer software, as they typically display only generic metadata and may not retrieve all existing metadata properties. Custom metadata is particularly valuable when implementing PDF security features or creating specialized document workflows.

How Do I Add and Edit Custom Metadata Properties?

To add custom metadata, access the CustomProperties property and invoke the Add method. Editing custom metadata requires passing the key value to the CustomProperties property and reassigning its value. This functionality integrates well with PDF form editing scenarios where you might need to track form submission metadata.

using IronPdf;
using IronPdf.MetaData;

ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>Metadata</h1>");

PdfCustomMetadataProperties customProperties = pdf.MetaData.CustomProperties;

// Add custom property
customProperties.Add("foo", "bar"); // Key: foo, Value: bar

// Edit custom property
customProperties["foo"] = "baz";

Advanced Custom Metadata Scenarios

Custom metadata becomes particularly powerful when building document management systems. Here's a comprehensive example demonstrating real-world usage:

using IronPdf;
using System;
using System.Linq;

public class DocumentTrackingSystem
{
    public static void AddTrackingMetadata(PdfDocument pdf, string userId, string projectId)
    {
        var customProps = pdf.MetaData.CustomProperties;
        
        // Add tracking information
        customProps.Add("ProcessedBy", userId);
        customProps.Add("ProcessedDate", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
        customProps.Add("ProjectID", projectId);
        customProps.Add("DocumentVersion", "1.0");
        customProps.Add("ReviewStatus", "Pending");
        
        // Add workflow metadata
        customProps.Add("WorkflowStep", "Initial Review");
        customProps.Add("NextReviewer", "John.Doe@company.com");
        customProps.Add("DueDate", DateTime.Now.AddDays(7).ToString("yyyy-MM-dd"));
        
        // Add compliance metadata
        customProps.Add("ComplianceChecked", "false");
        customProps.Add("RetentionPeriod", "7 years");
        customProps.Add("Classification", "Internal Use Only");
    }
    
    public static void UpdateReviewStatus(PdfDocument pdf, string status, string reviewer)
    {
        var customProps = pdf.MetaData.CustomProperties;
        
        // Update existing properties
        customProps["ReviewStatus"] = status;
        customProps["LastReviewedBy"] = reviewer;
        customProps["LastReviewDate"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
        
        // Increment version if approved
        if (status == "Approved" && customProps.ContainsKey("DocumentVersion"))
        {
            var currentVersion = customProps["DocumentVersion"];
            var versionParts = currentVersion.Split('.');
            var minorVersion = int.Parse(versionParts[1]) + 1;
            customProps["DocumentVersion"] = $"{versionParts[0]}.{minorVersion}";
        }
    }
}

How Do I Remove Custom Metadata Properties?

Remove custom metadata from a PDF document in two ways. Use the RemoveMetaDataKey method, accessible through the Metadata property, or use the Remove method from the CustomProperties property. This is particularly useful when sanitizing PDFs for public distribution or preparing documents for archival.

using IronPdf;

ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>Metadata</h1>");

// Add custom property to be deleted
pdf.MetaData.CustomProperties.Add("willBeDeleted", "value");

// Remove custom property _ two ways
pdf.MetaData.RemoveMetaDataKey("willBeDeleted");
pdf.MetaData.CustomProperties.Remove("willBeDeleted");

Introduction

PDF metadata serves as the backbone of document management systems, enabling efficient organization, searchability, and compliance tracking. IronPDF's metadata capabilities extend beyond simple property setting - they provide a comprehensive framework for building sophisticated document workflows. Whether implementing PDF/UA compliant documents for accessibility or creating custom tracking systems, metadata management is essential.

Best Practices for Metadata Management

  1. Consistency: Establish naming conventions for custom metadata keys
  2. Documentation: Maintain a registry of custom metadata fields used in your system
  3. Validation: Implement validation rules before setting metadata values
  4. Security: Avoid storing sensitive information in metadata unless the PDF is encrypted
  5. Compliance: Ensure metadata meets regulatory requirements for your industry

By leveraging IronPDF's metadata capabilities alongside features like digital signatures and PDF encryption, you can build robust document management solutions that meet enterprise requirements.

Ready to see what else you can do? Check out our tutorial page here: Sign and Secure PDFs

Frequently Asked Questions

What is the purpose of setting PDF metadata using IronPDF?

Setting PDF metadata using IronPDF helps in organizing, searching, and managing documents effectively by adding important information like title, author, and custom fields.

How do I set the PDF metadata title in IronPDF?

In IronPDF, you can set the PDF metadata title by accessing the `MetaData.Title` property of the PDF document object and assigning a desired value to it.

Can I retrieve existing PDF metadata using IronPDF?

Yes, IronPDF allows you to retrieve existing PDF metadata using methods like `GetMetaDataDictionary`, which provides access to the stored metadata information.

How can I impose custom metadata on a PDF document?

To impose custom metadata on a PDF document in IronPDF, use the `CustomProperties` property within the `MetaData` class and add or modify entries as needed.

Is it possible to remove PDF metadata with IronPDF?

Yes, IronPDF allows you to remove PDF metadata using methods such as `RemoveMetaDataKey` for specific keys or the `Remove` method for removing custom properties.

What are some use cases for custom metadata in IronPDF?

Custom metadata in IronPDF can be used for document classification, implementing document tracking systems, or managing workflows with specific custom properties.

How does IronPDF handle batch processing of metadata?

IronPDF supports batch processing of metadata by allowing standardization of metadata across multiple documents, accessible via code loops that modify the `MetaData` properties.

What features does IronPDF offer to complement metadata management?

Apart from metadata management, IronPDF offers features like PDF compression, digital signatures, and encryption to ensure a comprehensive PDF management solution.

Why is metadata consistency important in document management?

Metadata consistency is crucial in document management as it ensures that all files are uniformly classified and tracked, facilitating easier retrieval and compliance with industry standards.

How does IronPDF integrate metadata with PDF/A compliance?

IronPDF integrates metadata with PDF/A by providing robust metadata management tools that align with the archival requirements stipulated under the PDF/A compliance standards.

Curtis Chau
Technical Writer

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.

...
Read More

Ready to Get Started?

Nuget Downloads 20,809,720Version:2026.9just released

Get your FREE

30-day Trial Key instantly.

bullet_checkedNo credit card or account creation required
bullet_testTest in production
without watermarks
bullet_calendar30 days fully
functional product
bullet_support24/5 technical
support during trial
Get your free 30-day Trial Key instantly.
No credit card or account creation required
C# NuGet Library for PDF
Install with NuGet

Version: 2026.9

PM > Install-Package IronPdf
nuget.org/packages/IronPdf/
  1. In Solution Explorer, right-click References, Manage NuGet Packages
  2. Select Browse and search "IronPdf"
  3. Select the package and install
C# PDF DLL
Download DLL

Version: 2026.9

or download Windows Installer here.

  1. Download and unzip IronPDF to a location such as ~/Libs within your Solution directory
  2. In Visual Studio Solution Explorer, right click References. Select Browse, "IronPdf.dll"

Licenses from $999

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required