本文整理汇总了Java中com.lowagie.text.pdf.PdfWriter.PDFA1B属性的典型用法代码示例。如果您正苦于以下问题:Java PdfWriter.PDFA1B属性的具体用法?Java PdfWriter.PDFA1B怎么用?Java PdfWriter.PDFA1B使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.lowagie.text.pdf.PdfWriter
的用法示例。
在下文中一共展示了PdfWriter.PDFA1B属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createXmpMetadata
byte[] createXmpMetadata()
{
try
{
XMPMeta xmp = XMPMetaFactory.create();
xmp.setObjectName("");
xmp.setProperty(XMPConst.NS_DC, DublinCoreSchema.FORMAT, FORMAT_PDF);
xmp.setProperty(XMPConst.NS_PDF, PDF_PRODUCER, Document.getVersion());
if (pdfWriter.getPDFXConformance() == PdfWriter.PDFA1A)
{
xmp.setProperty(XMPConst.NS_PDFA_ID, PDFA_PART, PDFA_PART_1);
xmp.setProperty(XMPConst.NS_PDFA_ID, PDFA_CONFORMANCE, PDFA_CONFORMANCE_A);
}
else if (pdfWriter.getPDFXConformance() == PdfWriter.PDFA1B)
{
xmp.setProperty(XMPConst.NS_PDFA_ID, PDFA_PART, PDFA_PART_1);
xmp.setProperty(XMPConst.NS_PDFA_ID, PDFA_CONFORMANCE, PDFA_CONFORMANCE_B);
}
xmp.setProperty(XMPConst.NS_XMP, XMP_CREATE_DATE, ((PdfDate) info.get(PdfName.CREATIONDATE)).getW3CDate());
xmp.setProperty(XMPConst.NS_XMP, XMP_MODIFY_DATE, ((PdfDate) info.get(PdfName.MODDATE)).getW3CDate());
String title = extractInfo(PdfName.TITLE);
if (title != null)
{
xmp.setLocalizedText(XMPConst.NS_DC, DublinCoreSchema.TITLE,
//FIXME use the tag language?
XMPConst.X_DEFAULT, XMPConst.X_DEFAULT, title);
}
String author = extractInfo(PdfName.AUTHOR);
if (author != null)
{
//FIXME cache the options?
PropertyOptions arrayOrdered = new PropertyOptions().setArrayOrdered(true);
xmp.appendArrayItem(XMPConst.NS_DC, DublinCoreSchema.CREATOR, arrayOrdered, author, null);
}
String subject = extractInfo(PdfName.SUBJECT);
if (subject != null)
{
PropertyOptions array = new PropertyOptions().setArray(true);
xmp.appendArrayItem(XMPConst.NS_DC, DublinCoreSchema.SUBJECT, array, subject, null);
xmp.setLocalizedText(XMPConst.NS_DC, DublinCoreSchema.DESCRIPTION,
XMPConst.X_DEFAULT, XMPConst.X_DEFAULT, subject);
}
String keywords = extractInfo(PdfName.KEYWORDS);
if (keywords != null)
{
xmp.setProperty(XMPConst.NS_PDF, PDF_KEYWORDS, keywords);
}
String creator = extractInfo(PdfName.CREATOR);
if (creator != null)
{
xmp.setProperty(XMPConst.NS_XMP, XMP_CREATOR_TOOL, creator);
}
SerializeOptions options = new SerializeOptions();
options.setUseCanonicalFormat(true);
ByteArrayOutputStream out = new ByteArrayOutputStream(4096);
XMPMetaFactory.serialize(xmp, out, options);
return out.toByteArray();
}
catch (XMPException e)
{
throw new JRRuntimeException(e);
}
}
示例2: isPdfA1
/**
* Checks if the PDF has to be in conformance with PDFA1
* @return true of the PDF has to be in conformance with PDFA1
*/
public boolean isPdfA1() {
return pdfxConformance == PdfWriter.PDFA1A || pdfxConformance == PdfWriter.PDFA1B;
}