Example: This example demonstrates the elements needed to specify a document as PDF/A-1b compatible.
import com.cete.dynamicpdf.*;
import com.cete.dynamicpdf.pageelements.*;
import com.cete.dynamicpdf.xmp.*;
import com.cete.dynamicpdf.text.*;
public class MyClass{
public static void main(String args[]){
// Create a PDF Document
Document document = new Document();
// Set Document Title Property
document.setTitle("PDF/A1 Document");
// Create a XmpaMetadata instance
XmpMetadata xmp = new XmpMetadata();
// Add PDF/A schema with the conformance level.
PdfASchema pdfaschema = new PdfASchema(PdfAStandard.PDF_A_1b_2005);
xmp.addSchema(pdfaschema);
DublinCoreSchema dc = xmp.getDublinCore();
dc.getTitle().addLang("en-us", "PDF/A1 Document");
document.setXmpMetadata(xmp);
// Embedded iccprofile file
IccProfile iccProfile = new IccProfile("[PhysicalPath]/AdobeRGB1998.icc");
// Create Outputintent and add to documnet's outputIntents
OutputIntent outputIntents = new OutputIntent("", "IEC 61966-2.1 Default RGB colour space - sRGB 1 ", "http://www.color.org", "sRGB IEC61966-2.1 1", iccProfile);
outputIntents.setVersion( OutputIntentVersion.PDF_A);
document.getOutputIntents().add(outputIntents);
String text = "Hello World";
// Create a Type1font
Type1Font type1Font = new Type1Font("[PhysicalPath]/HELVETICA.PFM", "[PhysicalPath]/HELVETICA.PFB");
// Create a label using type1font
Label label = new Label(text, 0, 0, 504, 100, type1Font, 18, TextAlign.CENTER, RgbColor.getBlueViolet());
// Create a page
Page page = new Page(PageSize.LETTER, PageOrientation.PORTRAIT, 54.0f);
// Add label to the page
page.getElements().add(label);
// Add page to the document
document.getPages().add( page );
// Save the PDF
document.draw("[PhysicalPath]/MyDocument.pdf" );
}
}