Java Code Examples for com.lowagie.text.pdf.PdfWriter#PDFA1A
The following examples show how to use
com.lowagie.text.pdf.PdfWriter#PDFA1A .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JRPdfExporterTagHelper.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
/** * */ 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); } }
Example 2
Source File: PdfXmpCreator.java From jasperreports with GNU Lesser General Public License v3.0 | 4 votes |
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); } }
Example 3
Source File: PdfXConformanceImp.java From gcs with Mozilla Public License 2.0 | 2 votes |
/** * 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; }
Example 4
Source File: PdfXConformanceImp.java From gcs with Mozilla Public License 2.0 | 2 votes |
/** * 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; }
Example 5
Source File: PdfXConformanceImp.java From itext2 with GNU Lesser General Public License v3.0 | 2 votes |
/** * 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; }
Example 6
Source File: PdfXConformanceImp.java From itext2 with GNU Lesser General Public License v3.0 | 2 votes |
/** * 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; }