List of usage examples for com.itextpdf.text.pdf PdfWriter PDFX1A2001
int PDFX1A2001
To view the source code for com.itextpdf.text.pdf PdfWriter PDFX1A2001.
Click Source Link
From source file:com.vectorprint.report.itext.style.stylers.AdvancedImpl.java
License:Open Source License
/** * get a canvas for drawing, prepared according to settings * * @see #draw(com.itextpdf.text.Rectangle, java.lang.String) * @return// w w w . j ava 2s . co m */ protected final PdfContentByte getPreparedCanvas(float opacity) { needRestore = false; PdfContentByte canvas = (tableForeground != null) ? tableForeground : (isBg()) ? getWriter().getDirectContentUnder() : getWriter().getDirectContent(); String layerName = getLayerName(); BLENDMODE blend = getBlend(); if (getWriter().getPDFXConformance() == PdfWriter.PDFX1A2001) { // check blend, opacity, layers if (!PdfGState.BM_NORMAL.equals(blend.getBlend()) && !PdfGState.BM_COMPATIBLE.equals(blend.getBlend())) { throw new VectorPrintRuntimeException("blend not supported in PDF/X-1a: " + blend); } if (layerName != null) { throw new VectorPrintRuntimeException("layers not supported in PDF/X-1a: " + layerName); } if (opacity < 1) { throw new VectorPrintRuntimeException("opacity not supported in PDF/X-1a: " + opacity); } } if (layerName != null) { layerManager.startLayerInGroup(layerName, canvas); } // pgs.setAlphaIsShape(true); if (opacity <= 1) { // PdfShading shading = PdfShading.simpleAxial(getWriter(), 0, 0, getDocument().right() - getDocument().getPageSize().getWidth() * 0.6f, getDocument().top() - getDocument().getPageSize().getHeight() * 0.6f, Color.green, Color.orange,true,true); // canvas.paintShading(shading); canvas.saveState(); needRestore = true; PdfGState pgs = new PdfGState(); pgs.setFillOpacity(opacity); pgs.setStrokeOpacity(opacity); canvas.setGState(pgs); } if (!BLENDMODE.NORMAL.equals(blend)) { if (!needRestore) { canvas.saveState(); needRestore = true; } PdfGState pgs = new PdfGState(); pgs.setBlendMode(blend.getBlend()); canvas.setGState(pgs); } if (getTransform() != null && !(this instanceof Image)) { canvas.transform(new AffineTransform(getTransform())); } return canvas; }
From source file:com.vectorprint.report.itext.style.stylers.DocumentSettings.java
License:Open Source License
/** * called as the last step from {@link #style(java.lang.Object, java.lang.Object) }, calls {@link #builtInFontHack() * } which is necessary when creating PDF/X-1a with iText. * * @param writer/*from w w w. java 2s . c o m*/ * @throws IOException * @throws DocumentException * @throws VectorPrintException */ protected void pdfA1A(PdfWriter writer) throws IOException, DocumentException, VectorPrintException { builtInFontHack(); writer.setPdfVersion(PdfWriter.PDF_VERSION_1_4); writer.setTagged(); writer.setPDFXConformance(PdfWriter.PDFX1A2001); }