Search in sources :

Example 1 with XMPSchemaPDF

use of org.apache.jempbox.xmp.XMPSchemaPDF in project openolat by klemens.

the class PdfDocument method addMetadata.

public void addMetadata(String title, String subject, String author) throws IOException, TransformerException {
    PDDocumentCatalog catalog = document.getDocumentCatalog();
    PDDocumentInformation info = document.getDocumentInformation();
    Calendar date = Calendar.getInstance();
    info.setAuthor(author);
    info.setCreator(author);
    info.setCreationDate(date);
    info.setModificationDate(date);
    info.setTitle(title);
    info.setSubject(subject);
    XMPMetadata metadata = new XMPMetadata();
    XMPSchemaPDF pdfSchema = metadata.addPDFSchema();
    pdfSchema.setProducer("OpenOLAT");
    XMPSchemaBasic basicSchema = metadata.addBasicSchema();
    basicSchema.setModifyDate(date);
    basicSchema.setCreateDate(date);
    basicSchema.setCreatorTool("OpenOLAT");
    basicSchema.setMetadataDate(date);
    XMPSchemaDublinCore dcSchema = metadata.addDublinCoreSchema();
    dcSchema.setTitle(title);
    dcSchema.addCreator(author);
    dcSchema.setDescription(subject);
    PDMetadata metadataStream = new PDMetadata(document);
    metadataStream.importXMPMetadata(metadata);
    catalog.setMetadata(metadataStream);
}
Also used : XMPSchemaDublinCore(org.apache.jempbox.xmp.XMPSchemaDublinCore) XMPMetadata(org.apache.jempbox.xmp.XMPMetadata) XMPSchemaBasic(org.apache.jempbox.xmp.XMPSchemaBasic) Calendar(java.util.Calendar) XMPSchemaPDF(org.apache.jempbox.xmp.XMPSchemaPDF) PDMetadata(org.apache.pdfbox.pdmodel.common.PDMetadata) PDDocumentInformation(org.apache.pdfbox.pdmodel.PDDocumentInformation) PDDocumentCatalog(org.apache.pdfbox.pdmodel.PDDocumentCatalog)

Example 2 with XMPSchemaPDF

use of org.apache.jempbox.xmp.XMPSchemaPDF in project OpenOLAT by OpenOLAT.

the class PdfDocument method addMetadata.

public void addMetadata(String title, String subject, String author) throws IOException, TransformerException {
    PDDocumentCatalog catalog = document.getDocumentCatalog();
    PDDocumentInformation info = document.getDocumentInformation();
    Calendar date = Calendar.getInstance();
    info.setAuthor(author);
    info.setCreator(author);
    info.setCreationDate(date);
    info.setModificationDate(date);
    info.setTitle(title);
    info.setSubject(subject);
    XMPMetadata metadata = new XMPMetadata();
    XMPSchemaPDF pdfSchema = metadata.addPDFSchema();
    pdfSchema.setProducer("OpenOLAT");
    XMPSchemaBasic basicSchema = metadata.addBasicSchema();
    basicSchema.setModifyDate(date);
    basicSchema.setCreateDate(date);
    basicSchema.setCreatorTool("OpenOLAT");
    basicSchema.setMetadataDate(date);
    XMPSchemaDublinCore dcSchema = metadata.addDublinCoreSchema();
    dcSchema.setTitle(title);
    dcSchema.addCreator(author);
    dcSchema.setDescription(subject);
    PDMetadata metadataStream = new PDMetadata(document);
    metadataStream.importXMPMetadata(metadata);
    catalog.setMetadata(metadataStream);
}
Also used : XMPSchemaDublinCore(org.apache.jempbox.xmp.XMPSchemaDublinCore) XMPMetadata(org.apache.jempbox.xmp.XMPMetadata) XMPSchemaBasic(org.apache.jempbox.xmp.XMPSchemaBasic) Calendar(java.util.Calendar) XMPSchemaPDF(org.apache.jempbox.xmp.XMPSchemaPDF) PDMetadata(org.apache.pdfbox.pdmodel.common.PDMetadata) PDDocumentInformation(org.apache.pdfbox.pdmodel.PDDocumentInformation) PDDocumentCatalog(org.apache.pdfbox.pdmodel.PDDocumentCatalog)

Aggregations

Calendar (java.util.Calendar)2 XMPMetadata (org.apache.jempbox.xmp.XMPMetadata)2 XMPSchemaBasic (org.apache.jempbox.xmp.XMPSchemaBasic)2 XMPSchemaDublinCore (org.apache.jempbox.xmp.XMPSchemaDublinCore)2 XMPSchemaPDF (org.apache.jempbox.xmp.XMPSchemaPDF)2 PDDocumentCatalog (org.apache.pdfbox.pdmodel.PDDocumentCatalog)2 PDDocumentInformation (org.apache.pdfbox.pdmodel.PDDocumentInformation)2 PDMetadata (org.apache.pdfbox.pdmodel.common.PDMetadata)2