Examples of ITextFSImage


Examples of org.xhtmlrenderer.pdf.ITextFSImage

                byte[] bytes = IOUtils.toByteArray(input);
                Image image = Image.getInstance(bytes);

                float factor = layoutContext.getDotsPerPixel();
                image.scaleAbsolute(image.getPlainWidth() * factor, image.getPlainHeight() * factor);
                FSImage fsImage = new ITextFSImage(image);
               
                if(cssHeight > -1 && cssWidth > -1) {
                    fsImage.scale(cssWidth, cssHeight);
                }
               
                return new ITextImageElement(fsImage);
            } catch (Exception e) {
                Log.error(Geonet.GEONETWORK, "Error writing metadata to PDF", e);
View Full Code Here

Examples of org.xhtmlrenderer.pdf.ITextFSImage

      if (option.isDefined()) {
        InputStream stream = option.get();
        try {
          Image image = Image.getInstance(getData(stream));
          scaleToOutputResolution(image);
          return new ImageResource(new ITextFSImage(image));
        } catch (Exception e) {
          Logger.error("fetching image " + uri, e);
          throw new RuntimeException(e);
        }
      } else {
View Full Code Here

Examples of org.xhtmlrenderer.pdf.ITextFSImage

    if (element.getNodeName().equals("img")
        && element.getAttribute("src").matches(".*/wr\\?wodata=[\\-0-9]*$")) {
      String key = element.getAttribute("src").replaceFirst(".*/wr\\?wodata=(.*)", "$1");
      try {
        NSData data = cachedDataForKey(key);
        FSImage fsImage = new ITextFSImage(Image.getInstance(data.bytes()));
        if (cssWidth != -1 || cssHeight != -1) {
          fsImage.scale(cssWidth, cssHeight);
        }
        return new ITextImageElement(fsImage);
      } catch (Exception e) {
        e.printStackTrace();
      }
View Full Code Here

Examples of org.xhtmlrenderer.pdf.ITextFSImage

          input = new FileInputStream(dataSrc);
        }

        final byte[] bytes = IOUtils.toByteArray(input);
        final Image image = Image.getInstance(bytes);
        final FSImage fsImage = new ITextFSImage(image);
        if (fsImage != null) {
          if ((cssWidth != -1) || (cssHeight != -1)) {
            fsImage.scale(cssWidth, cssHeight);
          }
          return new ITextImageElement(fsImage);
        }
      } catch (Exception e) {
        throw new RuntimeException(
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.