Class PDFImage

java.lang.Object
org.loboevolution.pdfview.PDFImage

public class PDFImage extends Object
Encapsulates a PDF Image
  • Constructor Details

  • Method Details

    • createImage

      public static PDFImage createImage(PDFObject obj, Map<String,PDFObject> resources, boolean useAsSMask) throws IOException
      Read a PDFImage from an image dictionary and stream
      Parameters:
      obj - the PDFObject containing the image's dictionary and stream
      resources - the current resources
      useAsSMask - - flag for switching colors in case image is used as sMask internally this is needed for handling transparency in smask images.
      Returns:
      a PDFImage object.
      Throws:
      IOException - if any.
    • getImage

      public BufferedImage getImage() throws PDFImageParseException
      Get the image that this PDFImage generates.
      Returns:
      a buffered image containing the decoded image data
      Throws:
      PDFImageParseException - if any.
    • parseData

      protected BufferedImage parseData(byte[] data, ByteBuffer jpegData) throws IOException

      Parse the image stream into a buffered image. Note that this is guaranteed to be called after all the other setXXX methods have been called.

      NOTE: the color convolving is extremely slow on large images. It would be good to see if it could be moved out into the rendering phases, where we might be able to scale the image down first.

      Parameters:
      data - the data when already completely filtered and uncompressed
      jpegData - a byte buffer if data still requiring the DCDTecode filter is being used
      Returns:
      a BufferedImage object.
      Throws:
      IOException - if any.