当前位置: 首页>>代码示例>>Java>>正文


Java PdfWriter.PDFA1A属性代码示例

本文整理汇总了Java中com.lowagie.text.pdf.PdfWriter.PDFA1A属性的典型用法代码示例。如果您正苦于以下问题:Java PdfWriter.PDFA1A属性的具体用法?Java PdfWriter.PDFA1A怎么用?Java PdfWriter.PDFA1A使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.lowagie.text.pdf.PdfWriter的用法示例。


在下文中一共展示了PdfWriter.PDFA1A属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:73,代码来源:PdfXmpCreator.java

示例2: init

/**
 *
 */
protected void init(PdfContentByte pdfContentByte)
{
	this.pdfContentByte = pdfContentByte;
	
	if (isTagged)
	{
		PdfStructureTreeRoot root = pdfWriter.getStructureTreeRoot();
		
		PdfName pdfNameALL = new PdfName("All");
		root.mapRole(pdfNameALL, PdfName.SECT);
		root.mapRole(PdfName.IMAGE, PdfName.FIGURE);
		root.mapRole(PdfName.TEXT, PdfName.TEXT);
		allTag = new PdfStructureElement(root, pdfNameALL);
		if(pdfWriter.getPDFXConformance() == PdfWriter.PDFA1A)
		{
			root.mapRole(new PdfName("Anchor"), PdfName.NONSTRUCT);
			root.mapRole(PdfName.TEXT, PdfName.SPAN);
		}
		else
		{
			root.mapRole(new PdfName("Anchor"), PdfName.TEXT);
		}
		
		if (language != null)
		{
			allTag.put(PdfName.LANG, new PdfString(language));
		}
		tagStack = new Stack<PdfStructureElement>();
		tagStack.push(allTag);
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:34,代码来源:JRPdfExporterTagHelper.java

示例3: 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;
}
 
开发者ID:albfernandez,项目名称:itext2,代码行数:7,代码来源:PdfXConformanceImp.java

示例4: isPdfA1A

/**
 * Checks if the PDF has to be in conformance with PDFA1A
 * @return true of the PDF has to be in conformance with PDFA1A
 */
public boolean isPdfA1A() {
	return pdfxConformance == PdfWriter.PDFA1A;
}
 
开发者ID:albfernandez,项目名称:itext2,代码行数:7,代码来源:PdfXConformanceImp.java


注:本文中的com.lowagie.text.pdf.PdfWriter.PDFA1A属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。