Editing PDF metadata with Nutrient .NET SDK
PDF metadata carries a document’s identity — its title, author, and other descriptive fields that search engines, document management systems, and PDF viewers read. Editing metadata programmatically keeps large document libraries consistent without manual work in a PDF editor.
Use programmatic metadata editing to:
- Normalize author and title fields across a document library.
- Stamp generated documents with product or organization identity.
- Correct metadata before archiving or distribution.
Edit PDF metadata with the .NET SDK
You can read and write PDF metadata in a .NET application with the Nutrient .NET SDK. The SDK edits the document in place and saves a new file, so the original stays untouched.
Prepare the project
Start by importing the Nutrient namespace:
using Nutrient;Load the PDF document and create an editor
Open the source document, then create a PdfEditor for it. The editor exposes the document’s metadata object:
try{ using Document document = Document.Open("input.pdf"); using PdfEditor editor = PdfEditor.Edit(document);Update the metadata fields
Fetch the metadata object and set the fields you want to change:
var metadata = editor.Metadata; metadata.Author = "New author value"; metadata.Title = "New title value";The metadata object also exposes subject, keywords, creator, and producer through the corresponding properties.
Save the edited document
Write the result to a new file:
editor.SaveAs("output.pdf"); Console.WriteLine("Successfully edited metadata");}catch (NutrientException e){ Console.Error.WriteLine($"Error: {e.Message}"); Environment.Exit(1);}Handle errors
Nutrient .NET SDK uses exception handling for errors. The methods in this guide throw a NutrientException if a failure occurs. The using statements release the editor and document handles even when a step fails.
Conclusion
You’ve edited PDF metadata and saved the result as a new document. The same editor object supports page manipulation and other document editing operations.