XMP Meta Data
Metadata is data that describes the characteristics or properties of a document and is different than the main contents of a document. For example, the contents include the actual text data and formatting information for a word processing document. In contrast, the metadata might consist of the author, modification date, or copyright status properties. The XMP (Extensible Metadata Platform) provides a standard format for creating, processing, and interchanging metadata for various applications.
XMP, the Extensible Metadata Platform, provides an understood standard that makes applications work more effectively with metadata.
XMP is provided with several schemas (predefined sets of Metadata property definitions relevant to a wide range of applications).
XMP Meta Data Schemas:
- The Dublin Core Schema provides a set of commonly used properties.
- The XMP Basic Schema contains properties that provide basic descriptive information.
- The Rights Management Schema includes properties related to rights management. These properties specify information regarding the legal restrictions associated with a resource.
- The Basic Job Ticket Schema describes a straightforward workflow or job information.
- The Paged-Text Schema obtains the maximum page size and the total number of pages in a document.
- Adobe PDF Schema specifies properties used with Adobe PDF files.
XMPMetaData
Use a Document class's XMPMetaData property to add XMP metadata to a PDF using the XMPMetaData class.
Properties
Property | Description |
---|---|
BasicSchema | Gets the BasicSchema schema object. |
DublinCore | Gets the DublinCoreSchema schema object. |
RequiredPdfObjects | Gets the number of PDF objects required by the resource. |
ResourceType | Gets the type of resource. (Inherited from Resource) |
Uid | Gets the unique ID of the resource. (Inherited from Resource) |
This class has the following method for adding an XmpSchema to the XMPMetaData.
AddSchema(XmpSchema)
The following examples illustrate how to create an XMPMetadata instance and add it to a document.
Figure 1. Opening a PDF with Dublin Core XMP metadata.
Basic Schema
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", GetImage()); //imageData is byte array
document.XmpMetadata = xmp;
document.Draw(outputPath);
Dim document As New Document()
document.Pages.Add(New Page(PageSize.Letter))
document.Pages.Add(New Page(PageSize.Letter))
Dim xmp As New XmpMetadata()
Dim bs As BasicSchema = xmp.BasicSchema
bs.Advisory.Add("Date")
bs.Advisory.Add("Contributors")
bs.Nickname = "xyz"
bs.Thumbnails.Add(106, 80, "JPEG", GetImage()) 'imageData is byte array
document.XmpMetadata = xmp
document.Draw(outputPath)
Dublin Core
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(outputPath);
Dim document As New Document()
document.Pages.Add(New Page(PageSize.Letter))
document.Pages.Add(New Page(PageSize.Letter))
Dim xmp As New XmpMetadata()
Dim dc As DublinCoreSchema = 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(outputPath)
Rights Management
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(outputPath);
Dim document As New Document()
document.Pages.Add(New Page(PageSize.Letter))
document.Pages.Add(New Page(PageSize.Letter))
Dim xmp As New XmpMetadata()
Dim rm As 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(outputPath)
Basic Job Ticket
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(outputPath);
Dim document As New Document()
document.Pages.Add(New Page(PageSize.Letter))
document.Pages.Add(New Page(PageSize.Letter))
Dim xmp As New XmpMetadata()
Dim job As 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(outputPath))
Page-Text
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(outputPath);
Dim document As New Document()
document.Pages.Add(New Page(PageSize.Letter))
document.Pages.Add(New Page(PageSize.Letter))
Dim xmp As New XmpMetadata()
Dim pt As New PagedTextSchema()
xmp.AddSchema(pt)
document.XmpMetadata = xmp
document.Draw(outputPath)