Package com.itextpdf.text

Examples of com.itextpdf.text.Image


     */
    public static Image getImage(URL url) throws IOException {
        InputStream is = null;
        try {
            is = url.openStream();
            Image img = getImage(is);
            img.setUrl(url);
            return img;
        }
        finally {
            if (is != null) {
                is.close();
View Full Code Here


     * @return the image
     */
    public static Image getImage(InputStream is, boolean noHeader, int size) throws IOException {
        BmpImage bmp = new BmpImage(is, noHeader, size);
        try {
            Image img = bmp.getImage();
            img.setDpi((int)(bmp.xPelsPerMeter * 0.0254d + 0.5d), (int)(bmp.yPelsPerMeter * 0.0254d + 0.5d));
            img.setOriginalType(Image.ORIGINAL_BMP);
            return img;
        }
        catch (BadElementException be) {
            throw new ExceptionConverter(be);
        }
View Full Code Here

     * @throws IOException on error
     * @return the image
     */
    public static Image getImage(byte data[]) throws IOException {
        ByteArrayInputStream is = new ByteArrayInputStream(data);
        Image img = getImage(is);
        img.setOriginalData(data);
        return img;
    }
View Full Code Here

        }
        return null;
    }

    private Image indexedModel(byte bdata[], int bpc, int paletteEntries) throws BadElementException {
        Image img = new ImgRaw(width, height, 1, bpc, bdata);
        PdfArray colorspace = new PdfArray();
        colorspace.add(PdfName.INDEXED);
        colorspace.add(PdfName.DEVICERGB);
        byte np[] = getPalette(paletteEntries);
        int len = np.length;
        colorspace.add(new PdfNumber(len / 3 - 1));
        colorspace.add(new PdfString(np));
        PdfDictionary ad = new PdfDictionary();
        ad.put(PdfName.COLORSPACE, colorspace);
        img.setAdditional(ad);
        return img;
    }
View Full Code Here

  public Image img(String fname) throws Exception {
    return Image.getInstance(fname);
  }
  public void img(String fname, float x, float y, float width, float height) throws Exception {
    Image img = Image.getInstance(fname);
    img(img, x,y,width,height);
  }
View Full Code Here

        head.setWidths(widths);
        ServletContext context = getServletContext();
       
        String relativeWebPath = "/images/logo_melon.gif";
        String absoluteDiskPath = context.getRealPath(relativeWebPath);
        Image headImage = Image.getInstance(absoluteDiskPath);
        headImage.scaleToFit(75, 75);

        imageCell = new PdfPCell(headImage);
        imageCell.setBorder(Rectangle.NO_BORDER);
        head.addCell(imageCell);
View Full Code Here

                head.setWidths(widths);

            ServletContext context = ServletActionContext.getServletContext();
        String relativeWebPath = "/images/logo_melon.gif";
        String absoluteDiskPath = context.getRealPath(relativeWebPath);
        Image headImage = Image.getInstance(absoluteDiskPath);
        headImage.scaleToFit(75, 75);
       
                imageCell = new PdfPCell(headImage);
                imageCell.setBorder(Rectangle.NO_BORDER);
                head.addCell(imageCell);
View Full Code Here

            int flags = 0;
            if (ff != null)
                flags = ff.intValue();
            if ((flags & PdfFormField.FF_PUSHBUTTON) != 0) {
                //we'll assume that the value is an image in base64
                Image img;
                try {
                    img = Image.getInstance(Base64.decode(value));
                }
                catch (Exception e) {
                    return false;
View Full Code Here

                    content.append("\nEI\nQ").append_i(separator);
                }
                else {
                    PdfName name;
                    PageResources prs = getPageResources();
                    Image maskImage = image.getImageMask();
                    if (maskImage != null) {
                        name = writer.addDirectImageSimple(maskImage);
                        prs.addXObject(name, writer.getImageReference(name));
                    }
                    name = writer.addDirectImageSimple(image);
View Full Code Here

   */
  public Image createImage(Map<String, String> attrs) throws DocumentException, IOException {
    String src = attrs.get(HtmlTags.SRC);
    if (src == null)
      return null;
    Image img = factory.createImage(
        src, attrs, chain, document,
        (ImageProvider)providers.get(IMG_PROVIDER),
        (ImageStore)providers.get(IMG_STORE),
        (String)providers.get(IMG_BASEURL));
    return img;
View Full Code Here

TOP

Related Classes of com.itextpdf.text.Image

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.