Aspose.Pdf

Adding XMPMetaData

WHAT IS METADATA AND XMP?

 

MetaData is a data component that describes data. The characteristics of metadata are similar to those of cataloguing that takes place in libraries, museums and archives. In shortly metadata answer who, what, when, where, why, and how about every facet of the data that are being documented.

 

With an XMP-enabled, information about a project can be captured during the content-creation process and embedded within the file and into a content-management system. Meaningful descriptions and titles, searchable keywords, and up-to-date author and copyright information can be captured in a format that is easily understood by you as well as by software applications, hardware devices, and even file formats.

 

ADDING EXTENSIBLE METADATA PLATFORM XMP in ASPOSE.PDF

 

XMP is a new feature that is added in Aspose.Pdf . This feature allow you to embed metadata, into file itself. With xmp you can add information like Creation Date,Creator Tool,Modify Date, Meta Data Date and any other User Defined property.

 

The following example demonstrates how to add XMP in Pdf.

 

Code Snippet

 

[C#]

 

Pdf pdf = new Pdf();

 

Section s = pdf.Sections.Add();

 

Text text1 = new Text("This is a test for XMP Metadata");

s.Paragraphs.Add(text1);

 

pdf.XmpMetadata = new XmpMetadata();

 

//core properties

pdf.XmpMetadata.AddCreationDate(System.DateTime.Now.ToString());

 

    //user properties

pdf.XmpMetadata.AddUserProperty("xmlns:dc=\"http://purl.org/dc/elements/1.1/\"","dc:contributor","Aspose");

 

    pdf.Save(@"d:\test\test.pdf");

 

[VB.Net]

 

  Dim pdf As Pdf = New Pdf

 

    Dim s As Section = pdf.Sections.Add()

    Dim text1 As Text = New Text("This is a test for XMP Metadata")

    s.Paragraphs.Add(text1)

 

    pdf.XmpMetadata = New XmpMetadata

 

    'core properties

    pdf.XmpMetadata.AddCreationDate(System.DateTime.Now.ToString())

 

    'user properties

    pdf.XmpMetadata.AddUserProperty("xmlns:dc='http://purl.org/dc/elements/1.1/'", "dc:contributor", "Aspose")

 

    pdf.Save("d:\test\test.pdf")

 

To Add XMP using the XML. Please check the following:

 

[XML]

 

<Pdf xmlns="Aspose.Pdf">

  <XmpMetadata>

      <MetadataItem Name="CreationDate" Value="2007-7-15 10:51:55" />

          <MetadataItem XmlNamespace="xmlns:dc='http://purl.org/dc/elements/1.1/'"         Name="dc:contributor" Value="Aspose" />

      </XmpMetadata>

      <Section>

          <Text><Segment>This is a test for XMP Metadata</Segment></Text>

      </Section>

  </Pdf>