retrieving XMP from existing document and creating a schema

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF Merger for Java (v5)  /  Re: retrieving XMP from existing document and creating a schema

DynamicPDF Merger for Java (v5) Forum

This email refers to this post :

http://www.DynamicPDF.com/Forums/DisplayThread.csp?ForumID=12&ThreadID=736#2261


I am trying to do the same here,

First i've set the value of a PDF using this code :

public class xmp {

        public static void main(String[] args) {
                MergeDocument m1 = new MergeDocument("c:/temp/1.pdf");
                XmpMetadata xmp = new XmpMetadata();
                BasicSchema bs = xmp.getBasicSchema();
              bs.getAdvisory().add( "Date" );
                bs.getAdvisory().add( "Contributors" );
                bs.setNickname( "xyz" );
                xmp.addSchema(bs);
                m1.setXmpMetadata(xmp);
                m1.draw("c:/temp/MyDocument2.pdf");
        }
}

Then i am trying to retrieve the basic schema value with this code but the xmp value is always null,

public class getxmpbasic {

        public static void main(String[] args) {
                MergeDocument m1 = new MergeDocument("c:/temp/MyDocument2.pdf");
                XmpMetadata xmp=m1.getXmpMetadata();
                BasicSchema bs = xmp.getBasicSchema();
                System.out.println(bs.getNickname());
        }

}


How can i retrieve this value of the basic schema out of an existing PDF ?
How can i create a new schema ? I would like to have something that really stick to my reality.
Posted by a ceTe Software moderator
Hello,

It is only possible to either preserve any existing XMP metadata within the PDF document or replace the XMP metadata using our API. It is not possible to retrieve the values of the XMP metadata that already exists within the PDF document.

As mentioned in the thread you referred, only the XMP values that are exposed through the Document's properties like Author, Subject, Keywords, etc. can be read.

Following link shows how to add XMP Metadata.

Thanks,
ceTe Software Support Team

All times are US Eastern Standard time. The time now is 2:49 PM.