List of usage examples for com.itextpdf.text.pdf PdfContentByte setGState
public void setGState(final PdfGState gstate)
From source file:PrefichaPDF.java
public static void drawRectangle(PdfContentByte content, float x, float y, float width, float height) { content.saveState();/*w w w .j a va 2 s.c o m*/ PdfGState state = new PdfGState(); content.setGState(state); content.setRGBColorFill(232, 232, 232); content.setColorStroke(BaseColor.LIGHT_GRAY); // content.setr content.setLineWidth((float) .5); content.rectangle(x, y, width, height); content.fillStroke(); content.restoreState(); }
From source file:PrefichaPDF.java
public static void drawRectangleSC(PdfContentByte content, float x, float y, float width, float height) { content.saveState();// www. j av a 2s .c o m PdfGState state = new PdfGState(); // state.setFillOpacity(0.6f); content.setGState(state); content.setRGBColorFill(0xFF, 0xFF, 0xFA); content.setColorStroke(BaseColor.LIGHT_GRAY); content.setLineWidth((float) .5); content.rectangle(x, y, width, height); content.fillStroke(); content.restoreState(); }
From source file:PrefichaPDF.java
public static void drawRectangleText(PdfContentByte content, float x, float y, float width, float height) { content.saveState();/*from ww w . j av a2s . c o m*/ PdfGState state = new PdfGState(); content.setGState(state); content.setRGBColorFill(0, 230, 255); content.setColorStroke(BaseColor.LIGHT_GRAY); content.setLineWidth((float) .5); content.rectangle(x, y, width, height); content.fillStroke(); content.restoreState(); }
From source file:com.qmetric.document.watermark.strategy.MessageWatermarkStrategy.java
License:Open Source License
private void applyTextTransparency(final PdfContentByte overContent) { // Make transparent - see http://itext-general.2136553.n4.nabble.com/Insert-transparent-Text-td2158904.html final PdfGState gstate = new PdfGState(); gstate.setFillOpacity(OPACITY);/*from w w w . j ava 2s.co m*/ gstate.setStrokeOpacity(OPACITY); overContent.saveState(); overContent.setGState(gstate); }
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// ww w . j a v a 2 s. c o 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:ConexionBD.CreaPrefichaPDF.java
public static void drawRectangle(PdfContentByte content, float x, float y, float width, float height) { content.saveState();//w ww . j a va 2 s . c o m PdfGState state = new PdfGState(); content.setGState(state); content.setRGBColorFill(232, 232, 232); content.setColorStroke(BaseColor.BLUE); content.setLineWidth((float) .5); content.rectangle(x, y, width, height); content.fillStroke(); content.restoreState(); }
From source file:ConexionBD.CreaPrefichaPDF.java
public static void drawRectangleSC(PdfContentByte content, float x, float y, float width, float height) { content.saveState();// w ww . ja v a 2 s.c om PdfGState state = new PdfGState(); content.setGState(state); content.setRGBColorFill(0xFF, 0xFF, 0xFA); content.setColorStroke(BaseColor.BLUE); content.setLineWidth((float) .5); content.rectangle(x, y, width, height); content.fillStroke(); content.restoreState(); }
From source file:ConexionBD.CreaPrefichaPDF.java
public static void drawRectangleText(PdfContentByte content, float x, float y, float width, float height) { content.saveState();//from w ww. ja v a 2 s . c o m PdfGState state = new PdfGState(); content.setGState(state); content.setRGBColorFill(0, 230, 255); content.setColorStroke(BaseColor.BLUE); content.setLineWidth((float) .5); content.rectangle(x, y, width, height); content.fillStroke(); content.restoreState(); }
From source file:edu.cornell.mannlib.vitro.webapp.visualization.visutils.PDFDocument.java
License:Open Source License
private void createTransparencyShapes(Document document, PdfWriter writer) throws Exception { PdfContentByte cb = writer.getDirectContent(); pictureBackdrop(document.leftMargin(), 350, cb); cb.saveState();//from www . j av a 2 s. c o m PdfGState gs1 = new PdfGState(); gs1.setFillOpacity(0.5f); cb.setGState(gs1); pictureCircles(document.leftMargin(), 350, cb); cb.restoreState(); cb.resetRGBColorFill(); }
From source file:edu.cornell.mannlib.vitro.webapp.visualization.visutils.PDFDocument.java
License:Open Source License
/** * Prints 3 circles in different colors that intersect with eachother. * @param x//from www.j ava 2 s .com * @param y * @param cb * @throws Exception */ public void pictureCircles(float x, float y, PdfContentByte cb) throws Exception { cb.saveState(); PdfGState gs1 = new PdfGState(); gs1.setFillOpacity(1.0f); cb.setGState(gs1); cb.setColorFill(new BaseColor(Color.red)); cb.circle(x + 70, y + 70, 50); cb.fill(); cb.restoreState(); cb.setColorFill(new BaseColor(Color.yellow)); cb.circle(x + 100, y + 130, 50); cb.fill(); cb.setColorFill(new BaseColor(Color.blue)); cb.circle(x + 130, y + 70, 50); cb.fill(); }