Add XMP Metadata to PDFs
Use DynamicPDF Core Suite for .NET to add a Basic Job Ticket Schema, Dublin Core Schema, Paged-Text Schema, Rights Management Schema, or an XMP Basic Schema to a PDF. The following C# examples show you how.
How to Add Basic Job Ticket Schema to PDF
The following steps and C# sample code illustrate adding a Basic Job Ticket Schema to a PDF document using DynamicPDF Core Suite for .NET.
Steps for Adding Basic Job Ticket Schema to a PDF Document
- Create a Documentobject.
- Create two Pageobjects and add to theDocumentinstance.
- Create an XmpMetadataobject and set its properties.
- Create a BasicJobTicketSchemaobject and assign it to theXmpMetadatainstance.
- Set the BasicJobTicketSchemaobject's properties.
- Add an XmpMetadataobject to theDocumentobject.
- Save the PDF document.
Sample Code - C#
Document document = new Document();
document.Pages.Add(new Page(PageSize.Letter));
document.Pages.Add(new Page(PageSize.Letter));
            
XmpMetadata xmp = new XmpMetadata();
            
BasicJobTicketSchema job = new BasicJobTicketSchema();
job.JobRef.Add("MyCompany", "Xmp Test", new Uri("http://www.mydomain.com/"));
job.JobRef.Add("MyProduct", "XMP Metadata", new Uri("http://www.mydomain.com/"));
xmp.AddSchema(job);
document.XmpMetadata = xmp;
            
document.Draw(@"Output.pdf");        
How to Add Dublin Core Schema to PDF
The following steps and C# sample code illustrate adding the Dublin Core Schema to a PDF document using Dynamic Core Suite.
Steps for Adding the Dublin Core Schema to a PDF Document
- Create a Documentobject.
- Create two Pageobject instances and add to the Document object.
- Create an XmpMetadataobject and set its properties.
- Create a DublinCoreSchemaobject and assign it to the XmpMetadata object instance.
- Set the DublinCoreSchemaproperties as set in the sample code below.
- Add the XmpMetadataobject to the Document object (note that the Dublin Core Schema is internally added automatically).
- Save the PDF document.
Sample Code - C#
Document document = new Document();
document.Pages.Add(new Page(PageSize.Letter));
document.Pages.Add(new Page(PageSize.Letter));
            
XmpMetadata xmp = new XmpMetadata();
            
DublinCoreSchema dc = xmp.DublinCore;
dc.Contributors.Add("Abc");
dc.Contributors.Add("Xyz");
dc.Contributors.Add("Pqrs");
dc.Coverage = "To test all the attributes of schema's provided";
dc.Creators.Add("MyProduct");
dc.Creators.Add("MyCompany");
dc.Date.Add(DateTime.Now);
dc.Description.AddLang("en-us", "XMP Schema's test");
dc.Identifier = "First XMP pdf";
dc.Publisher.Add("mydomain.com");
dc.Publisher.Add("MyCompany");
dc.Relation.Add("test pdf with xmp");
dc.Rights.DefaultText = "US English";
dc.Rights.AddLang("en-us", "All rights reserved 2012, MyCompany.");
dc.Source = "XMP Project";
dc.Subject.Add("eXtensible Metadata Platform");
dc.Title.AddLang("en-us", "XMP");
dc.Title.AddLang("it-it", "XMP - Piattaforma Estendible di Metadata");
dc.Title.AddLang("du-du", "De hallo Wereld");
dc.Title.AddLang("fr-fr", "XMP - Une Platforme Extensible pour les Métédonnées");
dc.Title.AddLang("DE-DE", "ÄËßÜ Hallo Welt");
document.XmpMetadata = xmp;
            
document.Draw(@"Output.pdf");        
How to Add Paged-Text Schema to PDF
The following steps and C# sample code illustrate adding a Paged-Text Schema to PDF document using DynamicPDF Core Suite.
Steps for Adding Paged-Text Schema to PDF Document
- Create a Documentobject.
- Create two Pageobjects and add to the Document object.
- Create an XmpMetadataobject and set its properties.
- Create a PagedTextSchemaobject and assign to the XmpMetadata object.
- Set the PagedTextSchemaobject's properties.
- Add the XmpMetadataobject to theDocumentinstance.
- Add the Drawmethod to output the PDF document.
Sample Code - C#
Document document = new Document();
document.Pages.Add(new Page(PageSize.Letter));
document.Pages.Add(new Page(PageSize.Letter));
            
XmpMetadata xmp = new XmpMetadata();
            
PagedTextSchema pt = new PagedTextSchema();
xmp.AddSchema(pt);
document.XmpMetadata = xmp;
            
document.Draw(@"Output.pdf");        
How to Add Rights Management Schema to PDF
The following steps and C# sample code illustrate adding a Rights Management Schema to a PDF document using DynamicPDF Core Suite.
Steps for Adding Rights Management Schema to a PDF Document
- Create a Documentobject.
- Create two Pageobjects and add to theDocumentobject.
- Create a XmpMetadataobject and set its properties.
- Create a RightsManagementSchemaobject and assign it to theXmpMetadataobject instance.
- Set the necessary properties for the RightsManagementSchemaobject.
- Add the XmpMetadataobject instance to theDocumentobject.
- Add the Drawmethod to output the PDF document.
Sample Code - C#
Document document = new Document();
document.Pages.Add(new Page(PageSize.Letter));
document.Pages.Add(new Page(PageSize.Letter));
            
XmpMetadata xmp = new XmpMetadata();
            
RightsManagementSchema rm = new RightsManagementSchema();
rm.Marked2 = CopyrightStatus.PublicDomain;
rm.Owner.Add("Company Name");
rm.UsageTerms.AddLang("en-us", "Contact MyCompany");
xmp.AddSchema(rm);
document.XmpMetadata = xmp;
            
document.Draw(@"Output.pdf");        
How to Add XMP Basic Schema to PDF
The following steps and C# sample code illustrate adding an XMP Basic Schema to a PDF document using DynamicPDF Core Suite.
Steps for Adding an XMP Basic Schema to a PDF Document
- Create a Documentobject.
- Create two Pageinstances and add to the Document object.
- Create a XmpMetadataobject and set its properties.
- Create a BasicSchemaobject and assign to theXmpMetadataobject.
- Set the BasicSchemaobject's properties.
- Add the XmpMetadatainstance to theDocumentinstance (note that the Basic Schema is internally added automatically).
- Add the Drawmethod to output the PDF document.
Sample Code - C#
Document document = new Document();
document.Pages.Add(new Page(PageSize.Letter));
document.Pages.Add(new Page(PageSize.Letter));
            
XmpMetadata xmp = new XmpMetadata();
            
BasicSchema bs = xmp.BasicSchema;
bs.Advisory.Add("Date");
bs.Advisory.Add("Contributors");
bs.Nickname = "xyz";
bs.Thumbnails.Add(106, 80, "JPEG", imageData); //imageData is byte array
document.XmpMetadata = xmp;
            
document.Draw(@"Output.pdf");        
GitHub Project
An example project is available on GitHub (examples.dynamicpdf-core-suite-dotnet-core). Examples are provided in C# and VB.NET. Clone or view the example project at GitHub. This specific example discussed on this page are all contained in following classes on GitHub
- C# - XmpMetadataExample.cs
- VB.NET - XmpMetaDataExample.vb
DynamicPDF Core Suite for .NET Information
DynamicPDF Core Suite for .NET combines creating, merging, and visual report creation into one powerful product for creating PDF documents. It is ideal for anyone who needs to generate PDF documents or reports or work with existing PDFs in their applications. With a free Evaluation Edition to try and with flexible and royalty-free licensing options, why not start using DynamicPDF Core Suite for .NET today!
- DynamicPDF Core Suite for .NET Product Page
- [DynamicPDF Core Suite for .NET Documentation](/docs/dotnet/dynamic-pdf-core-suite-welcome ")
More Information on XMP Metadata
- Refer to the XMPMetadata documentation topic
Available on Other Platforms
DynamicPDF Core Suite is also available for the Java and COM/ActiveX platforms. Refer to the respective product pages for more details.
- DynamicPDF Generator
- Java - DynamicPDF Generator for Java
- COM/ActiveX - DynamicPDF Generator for COM/ActiveX
 
- DynamicPDF Merger
- Java - DynamicPDF Merger for Java
- COM/ActiveX - DynamicPDF Merger for COM/ActiveX