/** * Adds an <CODE>Image</CODE> to the page. The <CODE>Image</CODE> must have * absolute positioning. * @param image the <CODE>Image</CODE> object * @throws DocumentException if the <CODE>Image</CODE> does not have absolute positioning */ public void addImage(final Image image) throws DocumentException { addImage(image, false); }
/** * Adds an <CODE>Image</CODE> to the page. The <CODE>Image</CODE> must have * absolute positioning. * @param image the <CODE>Image</CODE> object * @throws DocumentException if the <CODE>Image</CODE> does not have absolute positioning */ public void addImage(final Image image) throws DocumentException { addImage(image, false); }
/** * Adds an <CODE>Image</CODE> to the page. The positioning of the <CODE>Image</CODE> * is done with the transformation matrix. To position an <CODE>image</CODE> at (x,y) * use addImage(image, image_width, 0, 0, image_height, x, y). The image can be placed inline. * @param image the <CODE>Image</CODE> object * @param a an element of the transformation matrix * @param b an element of the transformation matrix * @param c an element of the transformation matrix * @param d an element of the transformation matrix * @param e an element of the transformation matrix * @param f an element of the transformation matrix * @param inlineImage <CODE>true</CODE> to place this image inline, <CODE>false</CODE> otherwise * @throws DocumentException on error */ public void addImage(final Image image, final float a, final float b, final float c, final float d, final float e, final float f, final boolean inlineImage) throws DocumentException { addImage(image, (double) a, (double) b, (double) c, (double) d, (double) e, (double) f, inlineImage); }
/** * Adds an <CODE>Image</CODE> to the page. The positioning of the <CODE>Image</CODE> * is done with the transformation matrix. To position an <CODE>image</CODE> at (x,y) * use addImage(image, image_width, 0, 0, image_height, x, y). * @param image the <CODE>Image</CODE> object * @param a an element of the transformation matrix * @param b an element of the transformation matrix * @param c an element of the transformation matrix * @param d an element of the transformation matrix * @param e an element of the transformation matrix * @param f an element of the transformation matrix * @throws DocumentException on error */ public void addImage(final Image image, final double a, final double b, final double c, final double d, final double e, final double f) throws DocumentException { addImage(image, a, b, c, d, e, f, false); }
/** * Adds an <CODE>Image</CODE> to the page. The positioning of the <CODE>Image</CODE> * is done with the transformation matrix. To position an <CODE>image</CODE> at (x,y) * use addImage(image, image_width, 0, 0, image_height, x, y). * @param image the <CODE>Image</CODE> object * @param a an element of the transformation matrix * @param b an element of the transformation matrix * @param c an element of the transformation matrix * @param d an element of the transformation matrix * @param e an element of the transformation matrix * @param f an element of the transformation matrix * @throws DocumentException on error */ public void addImage(final Image image, final float a, final float b, final float c, final float d, final float e, final float f) throws DocumentException { addImage(image, a, b, c, d, e, f, false); }
/** * Adds an <CODE>Image</CODE> to the page. The positioning of the <CODE>Image</CODE> * is done with the transformation matrix. To position an <CODE>image</CODE> at (x,y) * use addImage(image, image_width, 0, 0, image_height, x, y). The image can be placed inline. * @param image the <CODE>Image</CODE> object * @param a an element of the transformation matrix * @param b an element of the transformation matrix * @param c an element of the transformation matrix * @param d an element of the transformation matrix * @param e an element of the transformation matrix * @param f an element of the transformation matrix * @param inlineImage <CODE>true</CODE> to place this image inline, <CODE>false</CODE> otherwise * @throws DocumentException on error */ public void addImage(final Image image, final double a, final double b, final double c, final double d, final double e, final double f, final boolean inlineImage) throws DocumentException { addImage(image, a, b, c, d, e, f, inlineImage, false); }
/** * Adds an <CODE>Image</CODE> to the page. The positioning of the <CODE>Image</CODE> * is done with the transformation matrix. To position an <CODE>image</CODE> at (x,y) * use addImage(image, image_width, 0, 0, image_height, x, y). * @param image the <CODE>Image</CODE> object * @param a an element of the transformation matrix * @param b an element of the transformation matrix * @param c an element of the transformation matrix * @param d an element of the transformation matrix * @param e an element of the transformation matrix * @param f an element of the transformation matrix * @throws DocumentException on error */ public void addImage(final Image image, final double a, final double b, final double c, final double d, final double e, final double f) throws DocumentException { addImage(image, a, b, c, d, e, f, false); }
/** * Adds an <CODE>Image</CODE> to the page. The positioning of the <CODE>Image</CODE> * is done with the transformation matrix. To position an <CODE>image</CODE> at (x,y) * use addImage(image, image_width, 0, 0, image_height, x, y). * @param image the <CODE>Image</CODE> object * @param a an element of the transformation matrix * @param b an element of the transformation matrix * @param c an element of the transformation matrix * @param d an element of the transformation matrix * @param e an element of the transformation matrix * @param f an element of the transformation matrix * @throws DocumentException on error */ public void addImage(final Image image, final float a, final float b, final float c, final float d, final float e, final float f) throws DocumentException { addImage(image, a, b, c, d, e, f, false); }
/** * Adds an <CODE>Image</CODE> to the page. The positioning of the <CODE>Image</CODE> * is done with the transformation matrix. To position an <CODE>image</CODE> at (x,y) * use addImage(image, image_width, 0, 0, image_height, x, y). The image can be placed inline. * @param image the <CODE>Image</CODE> object * @param a an element of the transformation matrix * @param b an element of the transformation matrix * @param c an element of the transformation matrix * @param d an element of the transformation matrix * @param e an element of the transformation matrix * @param f an element of the transformation matrix * @param inlineImage <CODE>true</CODE> to place this image inline, <CODE>false</CODE> otherwise * @throws DocumentException on error */ public void addImage(final Image image, final double a, final double b, final double c, final double d, final double e, final double f, final boolean inlineImage) throws DocumentException { addImage(image, a, b, c, d, e, f, inlineImage, false); }
/** * Adds an <CODE>Image</CODE> to the page. The positioning of the <CODE>Image</CODE> * is done with the transformation matrix. To position an <CODE>image</CODE> at (x,y) * use addImage(image, image_width, 0, 0, image_height, x, y). The image can be placed inline. * @param image the <CODE>Image</CODE> object * @param a an element of the transformation matrix * @param b an element of the transformation matrix * @param c an element of the transformation matrix * @param d an element of the transformation matrix * @param e an element of the transformation matrix * @param f an element of the transformation matrix * @param inlineImage <CODE>true</CODE> to place this image inline, <CODE>false</CODE> otherwise * @throws DocumentException on error */ public void addImage(final Image image, final float a, final float b, final float c, final float d, final float e, final float f, final boolean inlineImage) throws DocumentException { addImage(image, (double) a, (double) b, (double) c, (double) d, (double) e, (double) f, inlineImage); }
/** * adds an image with the given matrix. * @param image image to add * @param transform transform to apply to the template prior to adding it. */ public void addImage(final Image image, final AffineTransform transform) throws DocumentException { double matrix[] = new double[6]; transform.getMatrix(matrix); addImage(image, matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5], false); }
/** * adds an image with the given matrix. * @param image image to add * @param transform transform to apply to the template prior to adding it. */ public void addImage(final Image image, final AffineTransform transform) throws DocumentException { double matrix[] = new double[6]; transform.getMatrix(matrix); addImage(image, matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5], false); }
@Override public void addImage( Image image, double a, double b, double c, double d, double e, double f, boolean inlineImage, boolean isMCBlockOpened ) throws DocumentException { if ( image instanceof ExtendedImage ) { ExtendedImage extImg = (ExtendedImage) image; super.addImage( extImg.getImage(), a, b, c, d, e, f + extImg.getOffsetY(), inlineImage, isMCBlockOpened ); } else { super.addImage( image, a, b, c, d, e, f, inlineImage, isMCBlockOpened ); } } }
/** * adds an image with the given matrix. * @param image image to add * @param transform transform to apply to the template prior to adding it. * @since 5.0.1 * @deprecated use com.itextpdf.text.geom.AffineTransform as parameter */ public void addImage(final Image image, final java.awt.geom.AffineTransform transform) throws DocumentException { double matrix[] = new double[6]; transform.getMatrix(matrix); addImage(image, new AffineTransform(matrix)); }
public void drawImage(FSImage fsImage, int x, int y) { if (fsImage instanceof PDFAsImage) { drawPDFAsImage((PDFAsImage) fsImage, x, y); } else { Image image = ((ITextFSImage) fsImage).getImage(); if (fsImage.getHeight() <= 0 || fsImage.getWidth() <= 0) { return; } AffineTransform at = AffineTransform.getTranslateInstance(x, y); at.translate(0, fsImage.getHeight()); at.scale(fsImage.getWidth(), fsImage.getHeight()); AffineTransform inverse = normalizeMatrix(_transform); AffineTransform flipper = AffineTransform.getScaleInstance(1, -1); inverse.concatenate(at); inverse.concatenate(flipper); double[] mx = new double[6]; inverse.getMatrix(mx); try { _currentPage.addImage(image, (float) mx[0], (float) mx[1], (float) mx[2], (float) mx[3], (float) mx[4], (float) mx[5]); } catch (DocumentException e) { throw new XRRuntimeException(e.getMessage(), e); } } }
public void addImage(Image image, float a, float b, float c, float d, float e, float f, boolean inlineImage) throws DocumentException { if (!colorized && (!image.isMask() || !(image.getBpc() == 1 || image.getBpc() > 0xff))) throw new DocumentException(MessageLocalization.getComposedMessage("not.colorized.typed3.fonts.only.accept.mask.images")); super.addImage(image, a, b, c, d, e, f, inlineImage); }
public void addImage(Image image, float a, float b, float c, float d, float e, float f, boolean inlineImage) throws DocumentException { if (!colorized && (!image.isMask() || !(image.getBpc() == 1 || image.getBpc() > 0xff))) throw new DocumentException(MessageLocalization.getComposedMessage("not.colorized.typed3.fonts.only.accept.mask.images")); super.addImage(image, a, b, c, d, e, f, inlineImage); }
public static void main(String[] args) { PdfStamper stamper = null; try { PdfReader reader = new PdfReader(dataPath + "/test.pdf"); stamper = new PdfStamper(reader , new FileOutputStream(dataPath + "/output_onlyImage.pdf")); PdfContentByte over = stamper.getOverContent(1); Image image = Image.getInstance(dataPath +"/sign.png"); image.setAbsolutePosition(0 , 0); image.scaleToFit(300 , 109); over.addImage(image); } catch (IOException e) { e.printStackTrace(); } catch (DocumentException e) { e.printStackTrace(); } finally { try { stamper.close(); } catch (DocumentException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }
/** * Adds an <CODE>Image</CODE> to the page. The <CODE>Image</CODE> must have * absolute positioning. The image can be placed inline. * @param image the <CODE>Image</CODE> object * @param inlineImage <CODE>true</CODE> to place this image inline, <CODE>false</CODE> otherwise * @throws DocumentException if the <CODE>Image</CODE> does not have absolute positioning */ public void addImage(final Image image, final boolean inlineImage) throws DocumentException { if (!image.hasAbsoluteY()) throw new DocumentException(MessageLocalization.getComposedMessage("the.image.must.have.absolute.positioning")); float matrix[] = image.matrix(); matrix[Image.CX] = image.getAbsoluteX() - matrix[Image.CX]; matrix[Image.CY] = image.getAbsoluteY() - matrix[Image.CY]; addImage(image, matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5], inlineImage); }
/** * Adds an <CODE>Image</CODE> to the page. The <CODE>Image</CODE> must have * absolute positioning. The image can be placed inline. * @param image the <CODE>Image</CODE> object * @param inlineImage <CODE>true</CODE> to place this image inline, <CODE>false</CODE> otherwise * @throws DocumentException if the <CODE>Image</CODE> does not have absolute positioning */ public void addImage(final Image image, final boolean inlineImage) throws DocumentException { if (!image.hasAbsoluteY()) throw new DocumentException(MessageLocalization.getComposedMessage("the.image.must.have.absolute.positioning")); float matrix[] = image.matrix(); matrix[Image.CX] = image.getAbsoluteX() - matrix[Image.CX]; matrix[Image.CY] = image.getAbsoluteY() - matrix[Image.CY]; addImage(image, matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5], inlineImage); }