本文整理汇总了Java中org.apache.jempbox.xmp.XMPSchemaBasic类的典型用法代码示例。如果您正苦于以下问题:Java XMPSchemaBasic类的具体用法?Java XMPSchemaBasic怎么用?Java XMPSchemaBasic使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XMPSchemaBasic类属于org.apache.jempbox.xmp包,在下文中一共展示了XMPSchemaBasic类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setMetadata
import org.apache.jempbox.xmp.XMPSchemaBasic; //导入依赖的package包/类
public void setMetadata(PDDocument doc) throws Exception {
PDDocumentCatalog catalog = doc.getDocumentCatalog();
PDDocumentInformation info = doc.getDocumentInformation();
GregorianCalendar cal = new GregorianCalendar();
cal.setTime(now);
XMPMetadata metadata = new XMPMetadata();
XMPSchemaPDF pdfSchema = metadata.addPDFSchema();
pdfSchema.setKeywords(info.getKeywords());
pdfSchema.setProducer(info.getProducer());
XMPSchemaBasic basicSchema = metadata.addBasicSchema();
basicSchema.setModifyDate(cal);
basicSchema.setCreateDate(cal);
basicSchema.setCreatorTool(info.getCreator());
basicSchema.setMetadataDate(cal);
XMPSchemaDublinCore dcSchema = metadata.addDublinCoreSchema();
dcSchema.setTitle(info.getTitle());
dcSchema.addCreator("PDFBox");
dcSchema.setDescription(info.getSubject());
PDMetadata metadataStream = new PDMetadata(doc);
metadataStream.importXMPMetadata(metadata);
catalog.setMetadata(metadataStream);
}
示例2: writePDFA
import org.apache.jempbox.xmp.XMPSchemaBasic; //导入依赖的package包/类
private File writePDFA(File pdfWithAttachments, FlowInstanceManager instanceManager, FlowInstanceEvent event) throws Exception {
File outputFile = getFile(instanceManager.getFlowInstanceID(), event);
outputFile.getParentFile().mkdirs();
PDDocument document = PDDocument.loadNonSeq(pdfWithAttachments, null);
try{
document.getDocumentInformation().setProducer("Open ePlatform 1.x");
PDDocumentCatalog cat = document.getDocumentCatalog();
PDMetadata metadata = new PDMetadata(document);
cat.setMetadata(metadata);
XMPMetadata xmp = new XMPMetadata();
XMPSchemaPDFAId pdfaid = new XMPSchemaPDFAId(xmp);
xmp.addSchema(pdfaid);
pdfaid.setConformance("A");
pdfaid.setPart(3);
pdfaid.setAbout("");
XMPSchemaBasic schemaBasic = new XMPSchemaBasic(xmp);
schemaBasic.setCreateDate(document.getDocumentInformation().getCreationDate());
schemaBasic.setModifyDate(document.getDocumentInformation().getModificationDate());
xmp.addSchema(schemaBasic);
XMPSchemaPDF schemaPDF = new XMPSchemaPDF(xmp);
schemaPDF.setProducer(document.getDocumentInformation().getProducer());
xmp.addSchema(schemaPDF);
XMPSchemaDublinCore schemaDublinCore = new XMPSchemaDublinCore(xmp);
schemaDublinCore.setTitle(document.getDocumentInformation().getTitle());
xmp.addSchema(schemaDublinCore);
metadata.importXMPMetadata(xmp);
InputStream colorProfile = this.getClass().getResourceAsStream("sRGB Color Space Profile.icm");
PDOutputIntent oi = new PDOutputIntent(document, colorProfile);
oi.setInfo("sRGB IEC61966-2.1");
oi.setOutputCondition("sRGB IEC61966-2.1");
oi.setOutputConditionIdentifier("sRGB IEC61966-2.1");
oi.setRegistryName("http://www.color.org");
cat.addOutputIntent(oi);
document.save(outputFile);
}finally{
document.close();
}
return outputFile;
}