Interface PDImage

    • Method Detail

      • getImage

        Bitmap getImage()
                 throws IOException
        Returns the content of this image as a Bitmap with ARGB_8888. The size of the returned image is the larger of the size of the image itself or its mask.
        Returns:
        content of this image as a buffered image.
        Throws:
        IOException
      • getImage

        Bitmap getImage​(Rect region,
                        int subsampling)
                 throws IOException
        Returns the content of this image as an AWT buffered image with an (A)RGB colored space. Only the subregion specified is rendered, and is subsampled by advancing the specified amount of rows and columns in the source image for every resulting pixel. Note that unlike the unparameterized version, this method does not cache the resulting image.
        Parameters:
        region - The region of the source image to get, or null if the entire image is needed. The actual region will be clipped to the dimensions of the source image.
        subsampling - The amount of rows and columns to advance for every output pixel, a value of 1 meaning every pixel will be read
        Returns:
        subsampled content of the requested subregion as a buffered image.
        Throws:
        IOException
      • getStencilImage

        Bitmap getStencilImage​(Paint paint)
                        throws IOException
        Returns an ARGB image filled with the given paint and using this image as a mask.
        Parameters:
        paint - the paint to fill the visible portions of the image with
        Returns:
        a masked image filled with the given paint
        Throws:
        IOException - if the image cannot be read
        IllegalStateException - if the image is not a stencil.
      • createInputStream

        InputStream createInputStream()
                               throws IOException
        Returns an InputStream containing the image data, irrespective of whether this is an inline image or an image XObject.
        Returns:
        Decoded stream
        Throws:
        IOException - if the data could not be read.
      • createInputStream

        InputStream createInputStream​(List<String> stopFilters)
                               throws IOException
        Returns an InputStream containing the image data, irrespective of whether this is an inline image or an image XObject. The given filters will not be decoded.
        Parameters:
        stopFilters - A list of filters to stop decoding at.
        Returns:
        Decoded stream
        Throws:
        IOException - if the data could not be read.
      • createInputStream

        InputStream createInputStream​(DecodeOptions options)
                               throws IOException
        Returns an InputStream, passing additional options to each filter. As a side effect, the filterSubsampled flag is set in DecodeOptions.
        Parameters:
        options - Additional decoding options passed to the filters used
        Returns:
        Decoded stream
        Throws:
        IOException - if the data could not be read
      • isEmpty

        boolean isEmpty()
        Returns true if the image has no data.
      • isStencil

        boolean isStencil()
        Returns true if the image is a stencil mask.
      • setStencil

        void setStencil​(boolean isStencil)
        Sets whether or not the image is a stencil. This corresponds to the ImageMask entry in the image stream's dictionary.
        Parameters:
        isStencil - True to make the image a stencil.
      • getBitsPerComponent

        int getBitsPerComponent()
        Returns bits per component of this image, or -1 if one has not been set.
      • setBitsPerComponent

        void setBitsPerComponent​(int bitsPerComponent)
        Set the number of bits per component.
        Parameters:
        bitsPerComponent - The number of bits per component.
      • setColorSpace

        void setColorSpace​(PDColorSpace colorSpace)
        Sets the color space for this image.
        Parameters:
        colorSpace - The color space for this image.
      • getHeight

        int getHeight()
        Returns height of this image, or -1 if one has not been set.
      • setHeight

        void setHeight​(int height)
        Sets the height of the image.
        Parameters:
        height - The height of the image.
      • getWidth

        int getWidth()
        Returns the width of this image, or -1 if one has not been set.
      • setWidth

        void setWidth​(int width)
        Sets the width of the image.
        Parameters:
        width - The width of the image.
      • setDecode

        void setDecode​(COSArray decode)
        Sets the decode array.
        Parameters:
        decode - the new decode array.
      • getDecode

        COSArray getDecode()
        Returns the decode array.
      • getInterpolate

        boolean getInterpolate()
        Returns true if the image should be interpolated when rendered.
      • setInterpolate

        void setInterpolate​(boolean value)
        Sets the Interpolate flag, true for high-quality image scaling.
      • getSuffix

        String getSuffix()
        Returns the suffix for this image type, e.g. "jpg"