Adding XMP metadata to PDF (.NET Core/Framework)

Basic Job Ticket Schema, Dublin Core Schema, Paged-Text Schema, Rights Management Schema, XMP Basic Schema can be added to PDF document using DynamicPDF Generator.

How to add Basic Job Ticket Schema to PDF in C#

Below are the steps and sample code to add Basic Job Ticket Schema to PDF document using the Generator product.

Steps for Adding Basic Job Ticket Schema to a PDF Document

  1. Create a Document object.
  2. Create as many Page object as needed.
  3. Create a XmpMetadata object and set the properties.
  4. Create a BasicJobTicketSchema object and assign to XmpMetadata.
  5. Set all the necessary properties for the BasicJobTicketSchema.
  6. Add XmpMetadata to the Document.
  7. 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(@"C:\Output.pdf");        

How to add Dublin Core Schema to PDF in C#

Below are the steps and sample code to add Dublin Core Schema to PDF document using the Generator product.

Steps for Adding Dublin Core Schema to a PDF Document

  1. Create a Document object.
  2. Create as many Page object as needed.
  3. Create a XmpMetadata object and set the properties.
  4. Create a DublinCoreSchema object and assign to XmpMetadata.
  5. Set all the necessary properties for the DublinCoreSchema.
  6. Add XmpMetadata to the Document (Dublin Core Schema is added automatically internally).
  7. 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(@"C:\Output.pdf");        

How to add Paged-Text Schema to PDF in C#

Below are the steps and sample code to add Paged-Text Schema to PDF document using the Generator product.

Steps for Adding Paged-Text Schema to a PDF Document

  1. Create a Document object.
  2. Create as many Page object as needed.
  3. Create a XmpMetadata object and set the properties.
  4. Create a PagedTextSchema object and assign to XmpMetadata.
  5. Set all the necessary properties for the PagedTextSchema.
  6. Add XmpMetadata to the Document.
  7. 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();
            
PagedTextSchema pt = new PagedTextSchema();
xmp.AddSchema(pt);

document.XmpMetadata = xmp;
            
document.Draw(@"C:\Output.pdf");        

How to add Rights Management Schema to PDF in C#

Below are the steps and sample code to add Rights Management Schema to PDF document using the Generator product.

Steps for Adding Rights Management Schema to a PDF Document

  1. Create a Document object.
  2. Create as many Page object as needed.
  3. Create a XmpMetadata object and set the properties.
  4. Create a RightsManagementSchema object and assign to XmpMetadata.
  5. Set all the necessary properties for the RightsManagementSchema.
  6. Add XmpMetadata to the Document.
  7. 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();
            
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(@"C:\Output.pdf");        

How to add XMP Basic Schema to PDF in C#

Below are the steps and sample code to add XMP Basic Schema to PDF document using the Generator product.

Steps for Adding XMP Basic Schema to a PDF Document

  1. Create a Document object.
  2. Create as many Page object as needed.
  3. Create a XmpMetadata object and set the properties.
  4. Create a BasicSchema object and assign to XmpMetadata.
  5. Set all the necessary properties for the BasicSchema.
  6. Add XmpMetadata to the Document (Basic Schema is added automatically internally).
  7. 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();
            
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(@"C:\Output.pdf");        

Getting Started

NuGet Package

DynamicPDF Generator is available on NuGet and is part of the ceTe.DynamicPDF.CoreSuite.NET package. The Core Suite package includes Generator, Merger and ReportWriter.

NuGet Package ID: ceTe.DynamicPDF.CoreSuite.NET

DynamicPDF Generator Information

More information can be found here:

Available in other platforms

DynamicPDF Generator is available for the following platforms. Refer to the respective product pages for more details.

Why Choose DynamicPDF?

  • Transparent Pricing
  • Lots of Features
  • Easy to Use
  • Great Support
  • Efficient Performance
  • Product Maturity (Over 18 Years)
  • Free Evaluation
  • .NET Core Support (Most Products)
  • Flexible Licensing

We’re Not The Only Ones That Think We’re Great!