Class ImageRenderInfo
java.lang.Object
com.itextpdf.kernel.pdf.canvas.parser.data.AbstractRenderInfo
com.itextpdf.kernel.pdf.canvas.parser.data.ImageRenderInfo
- All Implemented Interfaces:
IEventData
Represents image data from a PDF.
-
Field Summary
FieldsModifier and TypeFieldDescriptionHierarchy of nested canvas tags for the text from the most inner (nearest to text) tag to the most outer.private final PdfDictionaryThe color space dictionary from resources which are associated with the image.private final MatrixThe coordinate transformation matrix that was in effect when the image was rendered.private final PdfImageXObjectprivate final booleanDefines if the encountered image was inline.private final PdfNameFields inherited from class AbstractRenderInfo
gs -
Constructor Summary
ConstructorsConstructorDescriptionImageRenderInfo(Stack<CanvasTag> canvasTagHierarchy, CanvasGraphicsState gs, Matrix ctm, PdfStream imageStream, PdfName resourceName, PdfDictionary colorSpaceDictionary, boolean isInline) Creates an ImageRenderInfo. -
Method Summary
Modifier and TypeMethodDescriptionfloatgetArea()Gets the size of the image in User space units.Gets hierarchy of the canvas tags that wraps given text.Gets the color space dictionary of the image.getImage()Gets the image wrapped in ImageXObject.Gets the coordinate transformation matrix in User space which was active when this image was rendered.Gets the name of the image resource.intgetMcid()Gets the marked-content identifier associated with thisImageRenderInfoinstance.Gets the vector in User space representing the start point of the image.booleanhasMcid(int mcid) Checks if thisImageRenderInfoinstance is associated with a marked content sequence with a given mcid.booleanhasMcid(int mcid, boolean checkTheTopmostLevelOnly) Checks if thisImageRenderInfoinstance is associated with a marked content sequence with a given mcid.booleanisInline()Gets the inline flag.Methods inherited from class AbstractRenderInfo
checkGraphicsState, getGraphicsState, isGraphicsStatePreserved, preserveGraphicsState, releaseGraphicsState
-
Field Details
-
ctm
The coordinate transformation matrix that was in effect when the image was rendered. -
image
-
colorSpaceDictionary
The color space dictionary from resources which are associated with the image. -
isInline
private final boolean isInlineDefines if the encountered image was inline. -
resourceName
-
canvasTagHierarchy
-
-
Constructor Details
-
ImageRenderInfo
public ImageRenderInfo(Stack<CanvasTag> canvasTagHierarchy, CanvasGraphicsState gs, Matrix ctm, PdfStream imageStream, PdfName resourceName, PdfDictionary colorSpaceDictionary, boolean isInline) Creates an ImageRenderInfo.- Parameters:
canvasTagHierarchy- the hierarchy of nested canvas tags for the text from the most inner (nearest to text) tag to the most outergs- thecanvas graphics statectm- the coordinate transformation matrix at the time the image is renderedimageStream- the image stream objectresourceName- thenameof the image resourcecolorSpaceDictionary- the color space dictionary from resources which are associated with the imageisInline- defines if the encountered image was inline
-
-
Method Details
-
getImage
Gets the image wrapped in ImageXObject. You can:- get image bytes with
PdfImageXObject.getImageBytes(boolean), these image bytes represent native image, i.e you can write these bytes to disk and get just an usual image; - obtain PdfStream object which contains image dictionary with
PdfObjectWrapper.getPdfObject()method; - convert image to
BufferedImagewithPdfImageXObject.getBufferedImage(); // Android-Conversion-Skip-Line (java.awt library isn't available on Android)
- Returns:
- the
image
- get image bytes with
-
getImageResourceName
-
getStartPoint
-
getImageCtm
Gets the coordinate transformation matrix in User space which was active when this image was rendered.- Returns:
- the coordinate transformation matrix in User space which was active when this image was rendered
-
getArea
public float getArea()Gets the size of the image in User space units.- Returns:
- the size of the image, in User space units
-
isInline
public boolean isInline()Gets the inline flag.- Returns:
trueif image was inlined in original stream
-
getColorSpaceDictionary
Gets the color space dictionary of the image.- Returns:
- the color space dictionary from resources which are associated with the image
-
getCanvasTagHierarchy
-
getMcid
public int getMcid()Gets the marked-content identifier associated with thisImageRenderInfoinstance.- Returns:
- associated marked-content identifier or -1 in case content is unmarked
-
hasMcid
public boolean hasMcid(int mcid) Checks if thisImageRenderInfoinstance is associated with a marked content sequence with a given mcid.- Parameters:
mcid- a marked content id- Returns:
trueif the image is marked with this id,falseotherwise
-
hasMcid
public boolean hasMcid(int mcid, boolean checkTheTopmostLevelOnly) Checks if thisImageRenderInfoinstance is associated with a marked content sequence with a given mcid.- Parameters:
mcid- a marked content idcheckTheTopmostLevelOnly- indicates whether to check the topmost level of marked content stack only- Returns:
trueif thisImageRenderInfoinstance is marked with this id,falseotherwise
-