Example: This example shows how to create a DublinCoreSchema and add it to the Xmp Metadata.
import com.cete.dynamicpdf.*;
import com.cete.dynamicpdf.xmp.*;
import java.util.*;
public class MyClass{
public static void main(String args[]){
// Create a PDF Document
Document document = new Document();
// Add blank pages to the document
document.getPages().add( new Page( PageSize.LETTER ) );
document.getPages().add( new Page( PageSize.LETTER ) );
// Create an Xmp Metadata
XmpMetadata xmp = new XmpMetadata();
// Dublin Core Schema.
DublinCoreSchema dc = xmp.getDublinCore();
dc.getContributors().add( "Abc" );
dc.getContributors().add( "Xyz" );
dc.getContributors().add( "Pqrs" );
dc.setCoverage( "To test all the attributes of schema's provided" );
dc.getCreators().add( "MyProduct" );
dc.getCreators().add( "MyCompany" );
dc.getDate().add( new Date() );
dc.getDescription().addLang( "en-us", "XMP Schema's test" );
dc.setIdentifier( "First XMP pdf" );
dc.getPublisher().add( "mydomain.com" );
dc.getPublisher().add( "MyCompany" );
dc.getRelation().add( "test pdf with xmp" );
dc.getRights().setDefault( "US English" );
dc.getRights().addLang( "en-us", "All rights reserved 2006, MyCompany." );
dc.setSource( "XMP Project" );
dc.getSubject().add( "eXtensible Metadata Platform" );
dc.getTitle().addLang( "en-us", "XMP" );
dc.getTitle().addLang( "it-it", "XMP - Piattaforma Estendible di Metadata" );
dc.getTitle().addLang( "du-du", "De hallo Wereld" );
dc.getTitle().addLang( "fr-fr", "XMP - Une Platforme Extensible pour les Métédonnées" );
dc.getTitle().addLang( "DE-DE", "ÄËßÜ Hallo Welt" );
dc.getType().add( "Pdf file containing xmp metadata" );
// Note: Need not have to add Dublin Core Schema, already added internally
// Add the Xmp Metadata to the document
document.setXmpMetadata( xmp );
// Save the PDF
document.draw("[PhysicalPath]/MyDocument.pdf");
}
}