List of usage examples for com.lowagie.text.xml.xmp DublinCoreSchema DublinCoreSchema
public DublinCoreSchema()
From source file:de.unigoettingen.sub.commons.contentlib.pdflib.PDFManager.java
License:Apache License
/** * Write xmp metadata./* ww w . ja v a 2 s. c o m*/ * * @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()); }