java.lang.Object
com.lowagie.text.Rectangle
com.lowagie.text.Image
- All Implemented Interfaces:
Element
Deprecated.
An
Image is the representation of a graphic element (JPEG, PNG or GIF) that has to be inserted into the
document
Security consideration: This method accepts input and processes it without built-in validation,
filtering, or access restrictions. It may load resources such as local files or external URLs,
depending on the input. This can introduce security risks including unauthorized file access,
directory traversal, or server-side request forgery (SSRF).
It is the responsibility of the calling application to validate and sanitize all input
before passing it to this method, especially when handling user-controlled or external data.
Refer to established secure coding guidelines to ensure safe usage.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected floatDeprecated.This is the absolute X-position of the image.protected floatDeprecated.This is the absolute Y-position of the image.protected intDeprecated.The alignment of the Image.protected StringDeprecated.Text that can be shown instead of the image.protected AnnotationDeprecated.if the annotation is not null the image will be clickable.static final intDeprecated.This represents a coordinate in the transformation matrix.static final intDeprecated.This represents a coordinate in the transformation matrix.protected intDeprecated.The bits per component of the raw image.static final intDeprecated.This represents a coordinate in the transformation matrix.static final intDeprecated.This represents a coordinate in the transformation matrix.protected intDeprecated.this is the colorspace of a jpeg-image.protected intDeprecated.The compression level of the content streams.static final intDeprecated.This represents a coordinate in the transformation matrix.static final intDeprecated.This represents a coordinate in the transformation matrix.static final intDeprecated.this is a kind of image alignment.protected booleanDeprecated.Holds value of property deflated.protected intDeprecated.Holds value of property dpiX.protected intDeprecated.Holds value of property dpiY.static final intDeprecated.This represents a coordinate in the transformation matrix.static final intDeprecated.This represents a coordinate in the transformation matrix.protected ImageDeprecated.The image that serves as a mask for this image.protected floatDeprecated.the indentation to the left.protected floatDeprecated.the indentation to the right.protected booleanDeprecated.Holds value of property interpolation.protected booleanDeprecated.Image color inversionprotected PdfOCGDeprecated.Optional Content layer to which we want this Image to belong.static final intDeprecated.this is a kind of image alignment.protected booleanDeprecated.Is this image a mask?static final intDeprecated.this is a kind of image alignment.protected LongDeprecated.an iText attributed unique id for this image.static final intDeprecated.type of imagestatic final intDeprecated.type of imagestatic final intDeprecated.type of imagestatic final intDeprecated.type of imagestatic final intDeprecated.type of imagestatic final intDeprecated.type of imagestatic final intDeprecated.type of imagestatic final intDeprecated.type of imagestatic final intDeprecated.type of imagestatic final intDeprecated.type of imageprotected byte[]Deprecated.Holds value of property originalData.protected intDeprecated.Holds value of property originalType.protected floatDeprecated.This is the width of the image without rotation.protected floatDeprecated.This is the width of the image without rotation.static final int[]Deprecated.protected ICC_ProfileDeprecated.ICC Profile attachedprotected byte[]Deprecated.The raw data of the image.static final intDeprecated.this is a kind of image alignment.protected floatDeprecated.This is the rotation of the image in radians.protected floatDeprecated.This is the original height of the image taking rotation into account.protected floatDeprecated.This is the scaled width of the image taking rotation into account.protected floatDeprecated.The spacing after the image.protected floatDeprecated.The spacing before the image.protected PdfTemplate[]Deprecated.The template to be treated as an image.static final intDeprecated.this is a kind of image alignment.protected int[]Deprecated.this is the transparency information of the raw imageprotected intDeprecated.The image type.static final intDeprecated.this is a kind of image alignment.protected URLDeprecated.The URL of the image.Fields inherited from class com.lowagie.text.Rectangle
backgroundColor, border, borderColor, borderColorBottom, borderColorLeft, borderColorRight, borderColorTop, borderWidth, borderWidthBottom, borderWidthLeft, borderWidthRight, borderWidthTop, BOTTOM, BOX, llx, lly, NO_BORDER, offsetToTop, rotation, TOP, UNDEFINED, urx, ury, useVariableBordersFields inherited from interface com.lowagie.text.Element
ALIGN_BASELINE, ALIGN_BOTTOM, ALIGN_CENTER, ALIGN_JUSTIFIED, ALIGN_JUSTIFIED_ALL, ALIGN_LEFT, ALIGN_MIDDLE, ALIGN_RIGHT, ALIGN_TOP, ALIGN_UNDEFINED, ANCHOR, ANNOTATION, AUTHOR, CCITT_BLACKIS1, CCITT_ENCODEDBYTEALIGN, CCITT_ENDOFBLOCK, CCITT_ENDOFLINE, CCITTG3_1D, CCITTG3_2D, CCITTG4, CELL, CHAPTER, CHUNK, CREATIONDATE, CREATOR, FOOTNOTE, HEADER, IMGRAW, IMGTEMPLATE, JBIG2, JPEG, JPEG2000, KEYWORDS, LIST, LISTITEM, MARKED, MODIFICATIONDATE, MULTI_COLUMN_TEXT, PARAGRAPH, PHRASE, PRODUCER, PTABLE, RECTANGLE, ROW, SECTION, SUBJECT, TABLE, TITLE, YMARK -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloatDeprecated.Returns the absolute X position.floatDeprecated.Returns the absolute Y position.Deprecated.Getter for the dictionary with additional information.intDeprecated.Gets the alignment for the image.getAlt()Deprecated.Gets the alternative text for the image.Deprecated.Gets the annotation.intgetBpc()Deprecated.Gets the bpc for the image.intDeprecated.Gets the colorspace for the image.intDeprecated.Returns the compression level used for images written as a compressed stream.Deprecated.Getter for property directReference.intgetDpiX()Deprecated.Gets the dots-per-inch in the X direction.intgetDpiY()Deprecated.Gets the dots-per-inch in the Y direction.Deprecated.Gets the images ICC profile.Deprecated.Gets the explicit masking.floatDeprecated.Gets the current image rotation in radians.floatDeprecated.Gets the left indentation.floatDeprecated.Gets the right indentation.floatDeprecated.Getter for property initialRotation.static ImagegetInstance(byte[] imgb) Deprecated.gets an instance of an Imagestatic ImagegetInstance(int width, int height, boolean reverseBits, int typeCCITT, int parameters, byte[] data) Deprecated.Creates an Image with CCITT G3 or G4 compression.static ImagegetInstance(int width, int height, boolean reverseBits, int typeCCITT, int parameters, byte[] data, int[] transparency) Deprecated.Creates an Image with CCITT G3 or G4 compression.static ImagegetInstance(int width, int height, byte[] data, byte[] globals) Deprecated.Creates a JBIG2 Image.static ImagegetInstance(int width, int height, int components, int bpc, byte[] data) Deprecated.Gets an instance of an Image in raw mode.static ImagegetInstance(int width, int height, int components, int bpc, byte[] data, int[] transparency) Deprecated.Gets an instance of an Image in raw mode.static ImagegetInstance(Image image) Deprecated.gets an instance of an Imagestatic ImagegetInstance(PdfContentByte cb, Image awtImage, float quality) Deprecated.Gets an instance of a Image from a java.awt.Image.static ImagegetInstance(PdfTemplate template) Deprecated.gets an instance of an Imagestatic ImagegetInstance(PdfWriter writer, Image awtImage, float quality) Deprecated.Gets an instance of a Image from a java.awt.Image.static ImageDeprecated.Reuses an existing image.static ImagegetInstance(Image image, Color color) Deprecated.Gets an instance of an Image from a java.awt.Image.static ImagegetInstance(Image image, Color color, boolean forceBW) Deprecated.Gets an instance of an Image from a java.awt.Image.static ImagegetInstance(String filename) Deprecated.Gets an instance of an Image.static ImagegetInstance(String mediaType, String base64Data) Deprecated.static ImagegetInstance(URL url) Deprecated.Gets an instance of an Image.static ImagegetInstanceFromClasspath(String filename) Deprecated.Gets an instance of an Image from the classpath.getLayer()Deprecated.Gets the layer this image belongs to.Deprecated.Returns a serial id for the Image (reuse the same image more than once)byte[]Deprecated.Getter for property originalData.intDeprecated.Getter for property originalType.floatDeprecated.Gets the plain height of the image.floatDeprecated.Gets the plain width of the image.byte[]Deprecated.Gets the raw data for the image.floatDeprecated.Gets the scaled height of the image.floatDeprecated.Gets the scaled width of the image.protected static LongDeprecated.Creates a new serial id.floatDeprecated.Gets the spacing before this image.floatDeprecated.Gets the spacing before this image.Deprecated.Gets the template to be used as an image.int[]Deprecated.Returns the transparency.getUrl()Deprecated.Gets theString-representation of the reference to the image.floatDeprecated.Getter for property widthPercentage.floatDeprecated.Gets the X/Y pixel dimensionless aspect ratio.booleanDeprecated.Checks if theImageshas to be added at an absolute X position.booleanDeprecated.Checks if theImageshas to be added at an absolute position.booleanDeprecated.Checks is the image has an ICC profile.booleanDeprecated.Getter for property deflated.booleanisImgRaw()Deprecated.Returnstrueif the image is aImgRaw-object.booleanDeprecated.Returnstrueif the image is anImgTemplate-object.booleanDeprecated.Getter for property interpolation.booleanDeprecated.Getter for the inverted valuebooleanisJpeg()Deprecated.Returnstrueif the image is aJpeg-object.booleanisMask()Deprecated.Returnstrueif thisImageis a mask.booleanDeprecated.Returnstrueif thisImagehas the requisites to be a mask.booleanDeprecated.Checks if this element is nestable.booleanisSmask()Deprecated.Getter for property smask.voidmakeMask()Deprecated.Make thisImagea mask.float[]matrix()Deprecated.Returns the transformation matrix of the image.voidscaleAbsolute(float newWidth, float newHeight) Deprecated.Scale the image to an absolute width and an absolute height.voidscaleAbsoluteHeight(float newHeight) Deprecated.Scale the image to an absolute height.voidscaleAbsoluteWidth(float newWidth) Deprecated.Scale the image to an absolute width.voidscalePercent(float percent) Deprecated.Scale the image to a certain percentage.voidscalePercent(float percentX, float percentY) Deprecated.Scale the width and height of an image to a certain percentage.voidscaleToFit(float fitWidth, float fitHeight) Deprecated.Scales the image so that it fits a certain width and height.voidsetAbsolutePosition(float absoluteX, float absoluteY) Deprecated.Sets the absolute position of theImage.voidsetAdditional(PdfDictionary additional) Deprecated.Sets the /Colorspace key.voidsetAlignment(int alignment) Deprecated.Sets the alignment for the image.voidDeprecated.Sets the alternative information for the image.voidsetAnnotation(Annotation annotation) Deprecated.Sets the annotation of this Image.voidsetCompressionLevel(int compressionLevel) Deprecated.Sets the compression level to be used if the image is written as a compressed stream.voidsetDeflated(boolean deflated) Deprecated.Setter for property deflated.voidsetDirectReference(PdfIndirectReference directReference) Deprecated.Setter for property directReference.voidsetDpi(int dpiX, int dpiY) Deprecated.Sets the dots per inch valuevoidsetImageMask(Image mask) Deprecated.Sets the explicit masking.voidsetIndentationLeft(float f) Deprecated.Sets the left indentation.voidsetIndentationRight(float f) Deprecated.Sets the right indentation.voidsetInitialRotation(float initialRotation) Deprecated.Some image formats, like TIFF may present the images rotated that have to be compensated.voidsetInterpolation(boolean interpolation) Deprecated.Sets the image interpolation.voidsetInverted(boolean invert) Deprecated.Sets inverted true or falsevoidDeprecated.Sets the layer this image belongs to.voidsetOriginalData(byte[] originalData) Deprecated.Setter for property originalData.voidsetOriginalType(int originalType) Deprecated.Setter for property originalType.voidsetRotation(float r) Deprecated.Sets the rotation of the image in radians.voidsetRotationDegrees(float deg) Deprecated.Sets the rotation of the image in degrees.voidsetSmask(boolean smask) Deprecated.Setter for property smask.voidsetSpacingAfter(float spacing) Deprecated.Sets the spacing after this image.voidsetSpacingBefore(float spacing) Deprecated.Sets the spacing before this image.voidsetTemplateData(PdfTemplate template) Deprecated.Sets data from a PdfTemplatevoidsetTransparency(int[] transparency) Deprecated.Sets the transparency valuesvoidDeprecated.Sets the url of the imagevoidsetWidthPercentage(float widthPercentage) Deprecated.Setter for property widthPercentage.voidsetXYRatio(float XYRatio) Deprecated.Sets the X/Y pixel dimensionless aspect ratio.voidDeprecated.Replaces CalRGB and CalGray colorspaces with DeviceRGB and DeviceGray.voidtagICC(ICC_Profile profile) Deprecated.Tags this image with an ICC profile.inttype()Deprecated.Returns the type.Methods inherited from class com.lowagie.text.Rectangle
cloneNonPositionParameters, disableBorderSide, enableBorderSide, getBackgroundColor, getBorder, getBorderColor, getBorderColorBottom, getBorderColorLeft, getBorderColorRight, getBorderColorTop, getBorderWidth, getBorderWidthBottom, getBorderWidthLeft, getBorderWidthRight, getBorderWidthTop, getBottom, getBottom, getChunks, getGrayFill, getHeight, getLeft, getLeft, getRelativeTop, getRight, getRight, getRotation, getTop, getTop, getWidth, hasBorder, hasBorders, isContent, isUseVariableBorders, normalize, process, rectangle, rotate, setBackgroundColor, setBorder, setBorderColor, setBorderColorBottom, setBorderColorLeft, setBorderColorRight, setBorderColorTop, setBorderWidth, setBorderWidthBottom, setBorderWidthLeft, setBorderWidthRight, setBorderWidthTop, setBottom, setGrayFill, setLeft, setRelativeTop, setRight, setRotation, setTop, setUseVariableBorders, softCloneNonPositionParameters, toString
-
Field Details
-
DEFAULT
public static final int DEFAULTDeprecated.this is a kind of image alignment.- See Also:
-
RIGHT
public static final int RIGHTDeprecated.this is a kind of image alignment.- See Also:
-
LEFT
public static final int LEFTDeprecated.this is a kind of image alignment.- See Also:
-
MIDDLE
public static final int MIDDLEDeprecated.this is a kind of image alignment.- See Also:
-
TEXTWRAP
public static final int TEXTWRAPDeprecated.this is a kind of image alignment.- See Also:
-
UNDERLYING
public static final int UNDERLYINGDeprecated.this is a kind of image alignment.- See Also:
-
AX
public static final int AXDeprecated.This represents a coordinate in the transformation matrix.- See Also:
-
AY
public static final int AYDeprecated.This represents a coordinate in the transformation matrix.- See Also:
-
BX
public static final int BXDeprecated.This represents a coordinate in the transformation matrix.- See Also:
-
BY
public static final int BYDeprecated.This represents a coordinate in the transformation matrix.- See Also:
-
CX
public static final int CXDeprecated.This represents a coordinate in the transformation matrix.- See Also:
-
CY
public static final int CYDeprecated.This represents a coordinate in the transformation matrix.- See Also:
-
DX
public static final int DXDeprecated.This represents a coordinate in the transformation matrix.- See Also:
-
DY
public static final int DYDeprecated.This represents a coordinate in the transformation matrix.- See Also:
-
ORIGINAL_NONE
public static final int ORIGINAL_NONEDeprecated.type of image- See Also:
-
ORIGINAL_JPEG
public static final int ORIGINAL_JPEGDeprecated.type of image- See Also:
-
ORIGINAL_PNG
public static final int ORIGINAL_PNGDeprecated.type of image- See Also:
-
ORIGINAL_GIF
public static final int ORIGINAL_GIFDeprecated.type of image- See Also:
-
ORIGINAL_BMP
public static final int ORIGINAL_BMPDeprecated.type of image- See Also:
-
ORIGINAL_TIFF
public static final int ORIGINAL_TIFFDeprecated.type of image- See Also:
-
ORIGINAL_WMF
public static final int ORIGINAL_WMFDeprecated.type of image- See Also:
-
ORIGINAL_PS
public static final int ORIGINAL_PSDeprecated.type of image- See Also:
-
ORIGINAL_JPEG2000
public static final int ORIGINAL_JPEG2000Deprecated.type of image- See Also:
-
ORIGINAL_JBIG2
public static final int ORIGINAL_JBIG2Deprecated.type of image- Since:
- 2.1.5
- See Also:
-
PNGID
public static final int[] PNGIDDeprecated. -
type
protected int typeDeprecated.The image type. -
url
Deprecated.The URL of the image. -
rawData
protected byte[] rawDataDeprecated.The raw data of the image. -
bpc
protected int bpcDeprecated.The bits per component of the raw image. It also flags a CCITT image. -
template
Deprecated.The template to be treated as an image. -
alignment
protected int alignmentDeprecated.The alignment of the Image. -
alt
Deprecated.Text that can be shown instead of the image. -
absoluteX
protected float absoluteXDeprecated.This is the absolute X-position of the image. -
absoluteY
protected float absoluteYDeprecated.This is the absolute Y-position of the image. -
plainWidth
protected float plainWidthDeprecated.This is the width of the image without rotation. -
plainHeight
protected float plainHeightDeprecated.This is the width of the image without rotation. -
scaledWidth
protected float scaledWidthDeprecated.This is the scaled width of the image taking rotation into account. -
scaledHeight
protected float scaledHeightDeprecated.This is the original height of the image taking rotation into account. -
compressionLevel
protected int compressionLevelDeprecated.The compression level of the content streams.- Since:
- 2.1.3
-
mySerialId
Deprecated.an iText attributed unique id for this image. -
rotationRadians
protected float rotationRadiansDeprecated.This is the rotation of the image in radians. -
indentationLeft
protected float indentationLeftDeprecated.the indentation to the left. -
indentationRight
protected float indentationRightDeprecated.the indentation to the right. -
spacingBefore
protected float spacingBeforeDeprecated.The spacing before the image. -
spacingAfter
protected float spacingAfterDeprecated.The spacing after the image. -
annotation
Deprecated.if the annotation is not null the image will be clickable. -
layer
Deprecated.Optional Content layer to which we want this Image to belong. -
interpolation
protected boolean interpolationDeprecated.Holds value of property interpolation. -
originalType
protected int originalTypeDeprecated.Holds value of property originalType. -
originalData
protected byte[] originalDataDeprecated.Holds value of property originalData. -
deflated
protected boolean deflatedDeprecated.Holds value of property deflated. -
dpiX
protected int dpiXDeprecated.Holds value of property dpiX. -
dpiY
protected int dpiYDeprecated.Holds value of property dpiY. -
colorspace
protected int colorspaceDeprecated.this is the colorspace of a jpeg-image. -
invert
protected boolean invertDeprecated.Image color inversion -
profile
Deprecated.ICC Profile attached -
mask
protected boolean maskDeprecated.Is this image a mask? -
imageMask
Deprecated.The image that serves as a mask for this image. -
transparency
protected int[] transparencyDeprecated.this is the transparency information of the raw image
-
-
Constructor Details
-
Image
Deprecated.Constructs anImage-object, using an url .- Parameters:
url- theURLwhere the image can be found.
-
Image
Deprecated.Constructs anImage-object, using an url .- Parameters:
image- another Image object.
-
-
Method Details
-
getInstance
Deprecated.- Throws:
BadElementException
-
getInstance
Deprecated.Gets an instance of an Image. Security consideration: This method accepts input and processes it without built-in validation, filtering, or access restrictions. It may load resources such as local files or external URLs, depending on the input. This can introduce security risks including unauthorized file access, directory traversal, or server-side request forgery (SSRF). It is the responsibility of the calling application to validate and sanitize all input before passing it to this method, especially when handling user-controlled or external data. Refer to established secure coding guidelines to ensure safe usage.- Parameters:
url- an URL- Returns:
- an Image
- Throws:
BadElementException- if error in creatingImgWMFMalformedURLException- if bad urlIOException- if image is not recognized
-
getInstance
Deprecated.Gets an instance of an Image. Security consideration: This method accepts input and processes it without built-in validation, filtering, or access restrictions. It may load resources such as local files or external URLs, depending on the input. This can introduce security risks including unauthorized file access, directory traversal, or server-side request forgery (SSRF). It is the responsibility of the calling application to validate and sanitize all input before passing it to this method, especially when handling user-controlled or external data. Refer to established secure coding guidelines to ensure safe usage.- Parameters:
filename- a filename- Returns:
- an object of type
Gif,JpegorPng - Throws:
BadElementException- if error in creatingImgWMFIOException- if image is not recognized
-
getInstanceFromClasspath
public static Image getInstanceFromClasspath(String filename) throws BadElementException, IOException Deprecated.Gets an instance of an Image from the classpath. Security consideration: This method accepts input and processes it without built-in validation, filtering, or access restrictions. It may load resources such as local files or external URLs, depending on the input. This can introduce security risks including unauthorized file access, directory traversal, or server-side request forgery (SSRF). It is the responsibility of the calling application to validate and sanitize all input before passing it to this method, especially when handling user-controlled or external data. Refer to established secure coding guidelines to ensure safe usage.- Parameters:
filename- a filename- Returns:
- an object of type
Gif,JpegorPng - Throws:
BadElementException- if error in creatingImgWMFIOException- if image is not recognized
-
getInstance
Deprecated.gets an instance of an Image- Parameters:
imgb- raw image date- Returns:
- an Image object
- Throws:
BadElementException- if error in creatingImgWMFIOException- if image is not recognized
-
getInstance
public static Image getInstance(int width, int height, int components, int bpc, byte[] data) throws BadElementException Deprecated.Gets an instance of an Image in raw mode.- Parameters:
width- the width of the image in pixelsheight- the height of the image in pixelscomponents- 1,3 or 4 for GrayScale, RGB and CMYKbpc- bits per componentdata- the image data- Returns:
- an object of type
ImgRaw - Throws:
BadElementException- on error
-
getInstance
Deprecated.Creates a JBIG2 Image.- Parameters:
width- the width of the imageheight- the height of the imagedata- the raw image dataglobals- JBIG2 globals- Returns:
- an
ImageObject - Since:
- 2.1.5
-
getInstance
public static Image getInstance(int width, int height, boolean reverseBits, int typeCCITT, int parameters, byte[] data) throws BadElementException Deprecated.Creates an Image with CCITT G3 or G4 compression. It assumes that the data bytes are already compressed.- Parameters:
width- the exact width of the imageheight- the exact height of the imagereverseBits- reverses the bits indata. Bit 0 is swapped with bit 7 and so ontypeCCITT- the type of compression indata. It can be CCITTG4, CCITTG31D, CCITTG32Dparameters- parameters associated with this stream. Possible values are CCITT_BLACKIS1, CCITT_ENCODEDBYTEALIGN, CCITT_ENDOFLINE and CCITT_ENDOFBLOCK or a combination of themdata- the image data- Returns:
- an Image object
- Throws:
BadElementException- on error
-
getInstance
public static Image getInstance(int width, int height, boolean reverseBits, int typeCCITT, int parameters, byte[] data, int[] transparency) throws BadElementException Deprecated.Creates an Image with CCITT G3 or G4 compression. It assumes that the data bytes are already compressed.- Parameters:
width- the exact width of the imageheight- the exact height of the imagereverseBits- reverses the bits indata. Bit 0 is swapped with bit 7 and so ontypeCCITT- the type of compression indata. It can be CCITTG4, CCITTG31D, CCITTG32Dparameters- parameters associated with this stream. Possible values are CCITT_BLACKIS1, CCITT_ENCODEDBYTEALIGN, CCITT_ENDOFLINE and CCITT_ENDOFBLOCK or a combination of themdata- the image datatransparency- transparency information in the Mask format of the image dictionary- Returns:
- an Image object
- Throws:
BadElementException- on error
-
getInstance
public static Image getInstance(int width, int height, int components, int bpc, byte[] data, int[] transparency) throws BadElementException Deprecated.Gets an instance of an Image in raw mode.- Parameters:
width- the width of the image in pixelsheight- the height of the image in pixelscomponents- 1,3 or 4 for GrayScale, RGB and CMYKbpc- bits per componentdata- the image datatransparency- transparency information in the Mask format of the image dictionary- Returns:
- an object of type
ImgRaw - Throws:
BadElementException- on error
-
getInstance
Deprecated.gets an instance of an Image- Parameters:
template- a PdfTemplate that has to be wrapped in anImageobject- Returns:
- an Image object
- Throws:
BadElementException- on error
-
getInstance
public static Image getInstance(Image image, Color color, boolean forceBW) throws BadElementException, IOException Deprecated.Gets an instance of an Image from a java.awt.Image.- Parameters:
image- thejava.awt.Imageto convertcolor- if different fromnullthe transparency pixels are replaced by this colorforceBW- iftruethe image is treated as black and white- Returns:
- an object of type
ImgRaw - Throws:
BadElementException- on errorIOException- on error
-
getInstance
Deprecated.Gets an instance of an Image from a java.awt.Image.- Parameters:
image- thejava.awt.Imageto convertcolor- if different fromnullthe transparency pixels are replaced by this color- Returns:
- an object of type
ImgRaw - Throws:
BadElementException- on errorIOException- on error
-
getInstance
public static Image getInstance(PdfWriter writer, Image awtImage, float quality) throws BadElementException, IOException Deprecated.Gets an instance of a Image from a java.awt.Image. The image is added as a JPEG with a user defined quality.- Parameters:
writer- thePdfWriterobject to which the image will be addedawtImage- thejava.awt.Imageto convertquality- a float value between0and1- Returns:
- an object of type
PdfTemplate - Throws:
BadElementException- on errorIOException- on error
-
getInstance
public static Image getInstance(PdfContentByte cb, Image awtImage, float quality) throws BadElementException, IOException Deprecated.Gets an instance of a Image from a java.awt.Image. The image is added as a JPEG with a user defined quality.- Parameters:
cb- thePdfContentByteobject to which the image will be addedawtImage- thejava.awt.Imageto convertquality- a float value between0and1- Returns:
- an object of type
PdfTemplate - Throws:
BadElementException- on errorIOException- on error
-
getInstance
Deprecated.Reuses an existing image.- Parameters:
ref- the reference to the image dictionary- Returns:
- the image
- Throws:
BadElementException- on error
-
getInstance
Deprecated.gets an instance of an Image- Parameters:
image- an Image object- Returns:
- a new Image object
-
getSerialId
Deprecated.Creates a new serial id.- Returns:
- a new serial id
-
getDirectReference
Deprecated.Getter for property directReference.- Returns:
- Value of property directReference.
-
setDirectReference
Deprecated.Setter for property directReference.- Parameters:
directReference- New value of property directReference.
-
type
public int type()Deprecated.Returns the type. -
isNestable
public boolean isNestable()Deprecated.Description copied from interface:ElementChecks if this element is nestable.- Specified by:
isNestablein interfaceElement- Overrides:
isNestablein classRectangle- Returns:
- true if this element can be nested inside other elements.
- Since:
- iText 2.0.8
- See Also:
-
isJpeg
public boolean isJpeg()Deprecated.Returnstrueif the image is aJpeg-object.- Returns:
- a
boolean
-
isImgRaw
public boolean isImgRaw()Deprecated.Returnstrueif the image is aImgRaw-object.- Returns:
- a
boolean
-
isImgTemplate
public boolean isImgTemplate()Deprecated.Returnstrueif the image is anImgTemplate-object.- Returns:
- a
boolean
-
getUrl
Deprecated.Gets theString-representation of the reference to the image.- Returns:
- a
String
-
setUrl
Deprecated.Sets the url of the image- Parameters:
url- the url of the image
-
getRawData
public byte[] getRawData()Deprecated.Gets the raw data for the image.Remark: this only makes sense for Images of the type
RawImage.- Returns:
- the raw data
-
getBpc
public int getBpc()Deprecated.Gets the bpc for the image.Remark: this only makes sense for Images of the type
RawImage.- Returns:
- a bpc value
-
getTemplateData
Deprecated.Gets the template to be used as an image.Remark: this only makes sense for Images of the type
ImgTemplate.- Returns:
- the template
-
setTemplateData
Deprecated.Sets data from a PdfTemplate- Parameters:
template- the template with the content
-
getAlignment
public int getAlignment()Deprecated.Gets the alignment for the image.- Returns:
- a value
-
setAlignment
public void setAlignment(int alignment) Deprecated.Sets the alignment for the image.- Parameters:
alignment- the alignment
-
getAlt
Deprecated.Gets the alternative text for the image.- Returns:
- a
String
-
setAlt
Deprecated.Sets the alternative information for the image.- Parameters:
alt- the alternative information
-
setAbsolutePosition
public void setAbsolutePosition(float absoluteX, float absoluteY) Deprecated.Sets the absolute position of theImage.- Parameters:
absoluteX- absolute x positionabsoluteY- absolute y position
-
hasAbsoluteX
public boolean hasAbsoluteX()Deprecated.Checks if theImageshas to be added at an absolute X position.- Returns:
- a boolean
-
getAbsoluteX
public float getAbsoluteX()Deprecated.Returns the absolute X position.- Returns:
- a position
-
hasAbsoluteY
public boolean hasAbsoluteY()Deprecated.Checks if theImageshas to be added at an absolute position.- Returns:
- a boolean
-
getAbsoluteY
public float getAbsoluteY()Deprecated.Returns the absolute Y position.- Returns:
- a position
-
getScaledWidth
public float getScaledWidth()Deprecated.Gets the scaled width of the image.- Returns:
- a value
-
getScaledHeight
public float getScaledHeight()Deprecated.Gets the scaled height of the image.- Returns:
- a value
-
getPlainWidth
public float getPlainWidth()Deprecated.Gets the plain width of the image.- Returns:
- a value
-
getPlainHeight
public float getPlainHeight()Deprecated.Gets the plain height of the image.- Returns:
- a value
-
scaleAbsolute
public void scaleAbsolute(float newWidth, float newHeight) Deprecated.Scale the image to an absolute width and an absolute height.- Parameters:
newWidth- the new widthnewHeight- the new height
-
scaleAbsoluteWidth
public void scaleAbsoluteWidth(float newWidth) Deprecated.Scale the image to an absolute width.- Parameters:
newWidth- the new width
-
scaleAbsoluteHeight
public void scaleAbsoluteHeight(float newHeight) Deprecated.Scale the image to an absolute height.- Parameters:
newHeight- the new height
-
scalePercent
public void scalePercent(float percent) Deprecated.Scale the image to a certain percentage.- Parameters:
percent- the scaling percentage
-
scalePercent
public void scalePercent(float percentX, float percentY) Deprecated.Scale the width and height of an image to a certain percentage.- Parameters:
percentX- the scaling percentage of the widthpercentY- the scaling percentage of the height
-
scaleToFit
public void scaleToFit(float fitWidth, float fitHeight) Deprecated.Scales the image so that it fits a certain width and height.- Parameters:
fitWidth- the width to fitfitHeight- the height to fit
-
matrix
public float[] matrix()Deprecated.Returns the transformation matrix of the image.- Returns:
- an array [AX, AY, BX, BY, CX, CY, DX, DY]
-
getMySerialId
Deprecated.Returns a serial id for the Image (reuse the same image more than once)- Returns:
- a serialId
-
getImageRotation
public float getImageRotation()Deprecated.Gets the current image rotation in radians.- Returns:
- the current image rotation in radians
-
setRotation
public void setRotation(float r) Deprecated.Sets the rotation of the image in radians.- Parameters:
r- rotation in radians
-
setRotationDegrees
public void setRotationDegrees(float deg) Deprecated.Sets the rotation of the image in degrees.- Parameters:
deg- rotation in degrees
-
getInitialRotation
public float getInitialRotation()Deprecated.Getter for property initialRotation.- Returns:
- Value of property initialRotation.
-
setInitialRotation
public void setInitialRotation(float initialRotation) Deprecated.Some image formats, like TIFF may present the images rotated that have to be compensated.- Parameters:
initialRotation- New value of property initialRotation.
-
getIndentationLeft
public float getIndentationLeft()Deprecated.Gets the left indentation.- Returns:
- the left indentation
-
setIndentationLeft
public void setIndentationLeft(float f) Deprecated.Sets the left indentation.- Parameters:
f- left indentation
-
getIndentationRight
public float getIndentationRight()Deprecated.Gets the right indentation.- Returns:
- the right indentation
-
setIndentationRight
public void setIndentationRight(float f) Deprecated.Sets the right indentation.- Parameters:
f- right indentation
-
getSpacingBefore
public float getSpacingBefore()Deprecated.Gets the spacing before this image.- Returns:
- the spacing
-
setSpacingBefore
public void setSpacingBefore(float spacing) Deprecated.Sets the spacing before this image.- Parameters:
spacing- the new spacing
-
getSpacingAfter
public float getSpacingAfter()Deprecated.Gets the spacing before this image.- Returns:
- the spacing
-
setSpacingAfter
public void setSpacingAfter(float spacing) Deprecated.Sets the spacing after this image.- Parameters:
spacing- the new spacing
-
getWidthPercentage
public float getWidthPercentage()Deprecated.Getter for property widthPercentage.- Returns:
- Value of property widthPercentage.
-
setWidthPercentage
public void setWidthPercentage(float widthPercentage) Deprecated.Setter for property widthPercentage.- Parameters:
widthPercentage- New value of property widthPercentage.
-
getAnnotation
Deprecated.Gets the annotation.- Returns:
- the annotation that is linked to this image
-
setAnnotation
Deprecated.Sets the annotation of this Image.- Parameters:
annotation- the annotation
-
getLayer
Deprecated.Gets the layer this image belongs to.- Returns:
- the layer this image belongs to or
nullfor no layer defined
-
setLayer
Deprecated.Sets the layer this image belongs to.- Parameters:
layer- the layer this image belongs to
-
isInterpolation
public boolean isInterpolation()Deprecated.Getter for property interpolation.- Returns:
- Value of property interpolation.
-
setInterpolation
public void setInterpolation(boolean interpolation) Deprecated.Sets the image interpolation. Image interpolation attempts to produce a smooth transition between adjacent sample values.- Parameters:
interpolation- New value of property interpolation.
-
getOriginalType
public int getOriginalType()Deprecated.Getter for property originalType.- Returns:
- Value of property originalType.
-
setOriginalType
public void setOriginalType(int originalType) Deprecated.Setter for property originalType.- Parameters:
originalType- New value of property originalType.
-
getOriginalData
public byte[] getOriginalData()Deprecated.Getter for property originalData.- Returns:
- Value of property originalData.
-
setOriginalData
public void setOriginalData(byte[] originalData) Deprecated.Setter for property originalData.- Parameters:
originalData- New value of property originalData.
-
isDeflated
public boolean isDeflated()Deprecated.Getter for property deflated.- Returns:
- Value of property deflated.
-
setDeflated
public void setDeflated(boolean deflated) Deprecated.Setter for property deflated.- Parameters:
deflated- New value of property deflated.
-
getDpiX
public int getDpiX()Deprecated.Gets the dots-per-inch in the X direction. Returns 0 if not available.- Returns:
- the dots-per-inch in the X direction
-
getDpiY
public int getDpiY()Deprecated.Gets the dots-per-inch in the Y direction. Returns 0 if not available.- Returns:
- the dots-per-inch in the Y direction
-
setDpi
public void setDpi(int dpiX, int dpiY) Deprecated.Sets the dots per inch value- Parameters:
dpiX- dpi for x coordinatesdpiY- dpi for y coordinates
-
getXYRatio
public float getXYRatio()Deprecated.Gets the X/Y pixel dimensionless aspect ratio.- Returns:
- the X/Y pixel dimensionless aspect ratio
-
setXYRatio
public void setXYRatio(float XYRatio) Deprecated.Sets the X/Y pixel dimensionless aspect ratio.- Parameters:
XYRatio- the X/Y pixel dimensionless aspect ratio
-
getColorspace
public int getColorspace()Deprecated.Gets the colorspace for the image.Remark: this only makes sense for Images of the type
Jpeg.- Returns:
- a colorspace value
-
isInverted
public boolean isInverted()Deprecated.Getter for the inverted value- Returns:
- true if the image is inverted
-
setInverted
public void setInverted(boolean invert) Deprecated.Sets inverted true or false- Parameters:
invert- true or false
-
tagICC
Deprecated.Tags this image with an ICC profile.- Parameters:
profile- the profile
-
hasICCProfile
public boolean hasICCProfile()Deprecated.Checks is the image has an ICC profile.- Returns:
- the ICC profile or
null
-
getICCProfile
Deprecated.Gets the images ICC profile.- Returns:
- the ICC profile
-
getAdditional
Deprecated.Getter for the dictionary with additional information.- Returns:
- a PdfDictionary with additional information.
-
setAdditional
Deprecated.Sets the /Colorspace key.- Parameters:
additional- a PdfDictionary with additional information.
-
simplifyColorspace
public void simplifyColorspace()Deprecated.Replaces CalRGB and CalGray colorspaces with DeviceRGB and DeviceGray. -
isMask
public boolean isMask()Deprecated.Returnstrueif thisImageis a mask.- Returns:
trueif thisImageis a mask
-
makeMask
Deprecated.Make thisImagea mask.- Throws:
DocumentException- if thisImagecan not be a mask
-
isMaskCandidate
public boolean isMaskCandidate()Deprecated.Returnstrueif thisImagehas the requisites to be a mask.- Returns:
trueif thisImagecan be a mask
-
getImageMask
Deprecated.Gets the explicit masking.- Returns:
- the explicit masking
-
setImageMask
Deprecated.Sets the explicit masking.- Parameters:
mask- the mask to be applied- Throws:
DocumentException- on error
-
isSmask
public boolean isSmask()Deprecated.Getter for property smask.- Returns:
- Value of property smask.
-
setSmask
public void setSmask(boolean smask) Deprecated.Setter for property smask.- Parameters:
smask- New value of property smask.
-
getTransparency
public int[] getTransparency()Deprecated.Returns the transparency.- Returns:
- the transparency values
-
setTransparency
public void setTransparency(int[] transparency) Deprecated.Sets the transparency values- Parameters:
transparency- the transparency values
-
getCompressionLevel
public int getCompressionLevel()Deprecated.Returns the compression level used for images written as a compressed stream.- Returns:
- the compression level (0 = best speed, 9 = best compression, -1 is default)
- Since:
- 2.1.3
-
setCompressionLevel
public void setCompressionLevel(int compressionLevel) Deprecated.Sets the compression level to be used if the image is written as a compressed stream.- Parameters:
compressionLevel- a value between 0 (best speed) and 9 (best compression)- Since:
- 2.1.3
-