Example usage for com.lowagie.text.xml.xmp PdfSchema VERSION

List of usage examples for com.lowagie.text.xml.xmp PdfSchema VERSION

Introduction

In this page you can find the example usage for com.lowagie.text.xml.xmp PdfSchema VERSION.

Prototype

String VERSION

To view the source code for com.lowagie.text.xml.xmp PdfSchema VERSION.

Click Source Link

Document

The PDF file version (for example: 1.0, 1.3, and so on).

Usage

From source file:de.unigoettingen.sub.commons.contentlib.pdflib.PDFManager.java

License:Apache License

/**
 * Write xmp metadata.// ww  w . j  av  a  2  s.  com
 * 
 * @param inWriter the in writer
 */
private void writeXMPMetadata(PdfWriter inWriter) {
    ByteArrayOutputStream os = new ByteArrayOutputStream();

    try {
        XmpWriter xmp = new XmpWriter(os);
        XmpSchema dc = new DublinCoreSchema();

        // set DublinCore metadata
        if (this.subject != null) {
            dc.setProperty(DublinCoreSchema.SUBJECT, this.subject);
        }
        if (this.title != null) {
            dc.setProperty(DublinCoreSchema.TITLE, this.title);
        }
        if (this.author != null) {
            dc.setProperty(DublinCoreSchema.CREATOR, this.author);
        }

        // add the DublinCore Simple Metadata to the RDF container

        xmp.addRdfDescription(dc);

        PdfSchema pdf = new PdfSchema();
        // set keywords
        pdf.setProperty(PdfSchema.KEYWORDS, "Hello World, XMP, Metadata");

        // set the version; must be 1.4 for PDF/A
        pdf.setProperty(PdfSchema.VERSION, "1.4");
        xmp.addRdfDescription(pdf);

        xmp.close();
    } catch (IOException e) {
        LOGGER.error("error occured while writing xmp metadata", e);
    }
    inWriter.setXmpMetadata(os.toByteArray());
}