Package org.xhtmlrenderer.pdf

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


      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

    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

          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

Related Classes of org.xhtmlrenderer.pdf.ITextFSImage

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.