Class ImageRenderInfo


  • public class ImageRenderInfo
    extends java.lang.Object
    Represents image data from a PDF
    Since:
    5.0.1
    • Field Detail

      • gs

        private final GraphicsState gs
        The graphics state that was in effect when the image was rendered
      • inlineImageInfo

        private final InlineImageInfo inlineImageInfo
        A reference to an inline image
      • colorSpaceDictionary

        private final PdfDictionary colorSpaceDictionary
        the color space associated with the image
      • imageObject

        private PdfImageObject imageObject
        the image object to be rendered, if it has been parsed already. Null otherwise.
      • markedContentInfos

        private final java.util.Collection<MarkedContentInfo> markedContentInfos
        Array containing marked content info for the text.
        Since:
        5.0.2
    • Method Detail

      • createForXObject

        public static ImageRenderInfo createForXObject​(GraphicsState gs,
                                                       PdfIndirectReference ref,
                                                       PdfDictionary colorSpaceDictionary)
        Create an ImageRenderInfo object based on an XObject (this is the most common way of including an image in PDF)
        Parameters:
        gs - graphic state of the XObject
        ref - a reference to the image XObject
        colorSpaceDictionary - colourspace of the image
        Returns:
        the ImageRenderInfo representing the rendered XObject
        Since:
        5.0.1
      • createForXObject

        public static ImageRenderInfo createForXObject​(GraphicsState gs,
                                                       PdfIndirectReference ref,
                                                       PdfDictionary colorSpaceDictionary,
                                                       java.util.Collection<MarkedContentInfo> markedContentInfo)
        Create an ImageRenderInfo object based on an XObject (this is the most common way of including an image in PDF)
        Parameters:
        gs - graphic state of the XObject
        ref - a reference to the image XObject
        colorSpaceDictionary - colourspace of the image
        markedContentInfo - marked content information for the XObject
        Returns:
        the ImageRenderInfo representing the rendered XObject
        Since:
        5.5.11
      • createForEmbeddedImage

        protected static ImageRenderInfo createForEmbeddedImage​(GraphicsState gs,
                                                                InlineImageInfo inlineImageInfo,
                                                                PdfDictionary colorSpaceDictionary,
                                                                java.util.Collection<MarkedContentInfo> markedContentInfo)
        Create an ImageRenderInfo object based on inline image data.
        Parameters:
        gs - graphic state of the XObject
        InlineImageInfo - a reference to the inline image
        colorSpaceDictionary - colourspace of the image
        markedContentInfo - marked content information for the XObject
        Returns:
        the ImageRenderInfo representing the rendered embedded image
        Since:
        5.0.1
      • getImage

        public PdfImageObject getImage()
                                throws java.io.IOException
        Gets an object containing the image dictionary and bytes.
        Returns:
        an object containing the image dictionary and byte[]
        Throws:
        java.io.IOException
        Since:
        5.0.2
      • prepareImageObject

        private void prepareImageObject()
                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • getStartPoint

        public Vector getStartPoint()
        Returns:
        a vector in User space representing the start point of the xobject
      • getImageCTM

        public Matrix getImageCTM()
        Returns:
        The coordinate transformation matrix active when this image was rendered. Coordinates are in User space.
        Since:
        5.0.3
      • getArea

        public float getArea()
        Returns:
        the size of the image, in User space units
        Since:
        5.0.3
      • getRef

        public PdfIndirectReference getRef()
        Returns:
        an indirect reference to the image
        Since:
        5.0.2
      • getCurrentFillColor

        public BaseColor getCurrentFillColor()
        Returns:
        the current fill color from the graphics state at the time this render operation occured
        Since:
        5.5.7
      • hasMcid

        public boolean hasMcid​(int mcid)
        Checks if the text belongs to a marked content sequence with a given mcid.
        Parameters:
        mcid - a marked content id
        Returns:
        true if the text is marked with this id
        Since:
        5.5.11
      • hasMcid

        public boolean hasMcid​(int mcid,
                               boolean checkTheTopmostLevelOnly)
        Checks if the text belongs to a marked content sequence with a given mcid.
        Parameters:
        mcid - a marked content id
        checkTheTopmostLevelOnly - indicates whether to check the topmost level of marked content stack only
        Returns:
        true if the text is marked with this id
        Since:
        5.5.11
      • getMcid

        public java.lang.Integer getMcid()
        Returns:
        the marked content associated with the TextRenderInfo instance.