com.cete.dynamicpdf.xmp
Class BasicSchema


Example: This example shows how to create a Basic Schema and add it to the Xmp Metadata.

import com.cete.dynamicpdf.*;
import com.cete.dynamicpdf.xmp.*;
import java.io.*;
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();
                   
	   // Basic Schema.
	   BasicSchema bs = xmp.getBasicSchema();
	   bs.getAdvisory().add( "Date" );
	   bs.getAdvisory().add( "Contributors" );	   
	   bs.setNickname( "xyz" );
	   bs.getThumbnails().add(106, 80, "JPEG", getImage( "[PhysicalPath]/thumbnail.jpg" ) );
	   // Note: Need not have to add Basic Schema, already added internally.
	 		
	   // Add the Xmp Metadata to the document
           document.setXmpMetadata( xmp );		
                                         
           // Save the PDF
           document.draw("[PhysicalPath]/MyDocument.pdf");
       }
       
       private static byte[] getImage( String filePath ) {
           byte[] binaryData = null;	
           try {
	       FileInputStream inFile = new FileInputStream( filePath );
	       binaryData = new byte[ inFile.available() ];
	       inFile.read( binaryData );
	       inFile.close();
	   } catch(Exception e) {
             System.out.println("EXCEPTION  "+e.getMessage());
           }		
	   return binaryData;
       }	
 }