com.lowagie.text
public abstract class Image extends Rectangle
Image
is the representation of a graphic element (JPEG, PNG
or GIF) that has to be inserted into the document
Field Summary | |
---|---|
static int | AX This represents a coordinate in the transformation matrix. |
static int | AY This represents a coordinate in the transformation matrix. |
protected float | absoluteX This is the absolute X-position of the image. |
protected float | absoluteY This is the absolute Y-position of the image. |
PdfDictionary | additional a dictionary with additional information |
protected int | alignment The alignment of the Image. |
protected String | alt Text that can be shown instead of the image. |
protected Annotation | annotation if the annotation is not null the image will be clickable. |
protected int | bpc The bits per component of the raw image. |
static int | BX This represents a coordinate in the transformation matrix. |
static int | BY This represents a coordinate in the transformation matrix. |
protected int | colorspace this is the colorspace of a jpeg-image. |
static int | CX This represents a coordinate in the transformation matrix. |
static int | CY This represents a coordinate in the transformation matrix. |
protected boolean | deflated Holds value of property deflated. |
PdfIndirectReference | directReference
Holds value of property directReference.
|
protected int | dpiX Holds value of property dpiX. |
protected int | dpiY Holds value of property dpiY. |
static int | DEFAULT this is a kind of image alignment. |
static int | DX This represents a coordinate in the transformation matrix. |
static int | DY This represents a coordinate in the transformation matrix. |
protected Image | imageMask The image that serves as a mask for this image. |
protected float | indentationLeft the indentation to the left. |
protected float | indentationRight the indentation to the right. |
float | initialRotation Holds value of property initialRotation. |
protected boolean | interpolation Holds value of property interpolation. |
protected boolean | invert Image color inversion |
protected PdfOCG | layer Optional Content layer to which we want this Image to belong. |
static int | LEFT this is a kind of image alignment. |
protected boolean | mask Is this image a mask? |
protected Long | mySerialId an iText attributed unique id for this image. |
static int | MIDDLE this is a kind of image alignment. |
protected byte[] | originalData Holds value of property originalData. |
protected int | originalType Holds value of property originalType. |
static int | ORIGINAL_BMP type of image |
static int | ORIGINAL_GIF type of image |
static int | ORIGINAL_JPEG type of image |
static int | ORIGINAL_NONE type of image |
static int | ORIGINAL_PNG type of image |
static int | ORIGINAL_PS type of image |
static int | ORIGINAL_TIFF type of image |
static int | ORIGINAL_WMF type of image |
protected float | plainHeight This is the width of the image without rotation. |
protected float | plainWidth This is the width of the image without rotation. |
protected ICC_Profile | profile ICC Profile attached |
protected byte[] | rawData The raw data of the image. |
protected float | rotationRadians This is the rotation of the image in radians. |
static int | RIGHT this is a kind of image alignment. |
protected float | scaledHeight This is the original height of the image taking rotation into account. |
protected float | scaledWidth This is the scaled width of the image taking rotation into account. |
static long | serialId a static that is used for attributing a unique id to each image. |
boolean | smask Holds value of property smask. |
protected float | spacingAfter The spacing after the image. |
protected float | spacingBefore The spacing before the image. |
protected PdfTemplate[] | template The template to be treated as an image. |
protected int[] | transparency this is the transparency information of the raw image |
protected int | type The imagetype. |
static int | TEXTWRAP this is a kind of image alignment. |
protected URL | url The URL of the image. |
static int | UNDERLYING this is a kind of image alignment. |
float | widthPercentage
Holds value of property widthPercentage. |
float | XYRatio Holds value of property XYRatio. |
Constructor Summary | |
---|---|
Image(URL url)
Constructs an Image -object, using an url .
| |
protected | Image(Image image)
Constructs an Image -object, using an url .
|
Method Summary | |
---|---|
float | absoluteX()
Returns the absolute X position.
|
float | absoluteY()
Returns the absolute Y position.
|
int | alignment()
Gets the alignment for the image.
|
String | alt()
Gets the alternative text for the image.
|
Annotation | annotation()
Gets the annotation.
|
int | bpc()
Gets the bpc for the image.
|
int | colorspace()
Gets the colorspace for the image.
|
float | getAbsoluteX()
Returns the absolute X position.
|
float | getAbsoluteY()
Returns the absolute Y position.
|
PdfDictionary | getAdditional()
Getter for the dictionary with additional information.
|
int | getAlignment()
Gets the alignment for the image.
|
String | getAlt()
Gets the alternative text for the image.
|
Annotation | getAnnotation()
Gets the annotation.
|
int | getBpc()
Gets the bpc for the image.
|
int | getColorspace()
Gets the colorspace for the image.
|
PdfIndirectReference | getDirectReference()
Getter for property directReference. |
int | getDpiX()
Gets the dots-per-inch in the X direction. |
int | getDpiY()
Gets the dots-per-inch in the Y direction. |
ICC_Profile | getICCProfile()
Gets the images ICC profile.
|
Image | getImageMask()
Gets the explicit masking.
|
float | getImageRotation()
Gets the current image rotation in radians. |
float | getIndentationLeft()
Gets the left indentation.
|
float | getIndentationRight()
Gets the right indentation.
|
float | getInitialRotation()
Getter for property initialRotation. |
static Image | getInstance(URL url)
Gets an instance of an Image.
|
static Image | getInstance(String filename)
Gets an instance of an Image.
|
static Image | getInstance(byte[] imgb)
gets an instance of an Image
|
static Image | getInstance(int width, int height, int components, int bpc, byte[] data)
Gets an instance of an Image in raw mode.
|
static Image | getInstance(int width, int height, boolean reverseBits, int typeCCITT, int parameters, byte[] data)
Creates an Image with CCITT G3 or G4 compression. |
static Image | getInstance(int width, int height, boolean reverseBits, int typeCCITT, int parameters, byte[] data, int[] transparency)
Creates an Image with CCITT G3 or G4 compression. |
static Image | getInstance(int width, int height, int components, int bpc, byte[] data, int[] transparency)
Gets an instance of an Image in raw mode.
|
static Image | getInstance(PdfTemplate template)
gets an instance of an Image
|
static Image | getInstance(Image image, Color color, boolean forceBW)
Gets an instance of an Image from a java.awt.Image.
|
static Image | getInstance(Image image, Color color)
Gets an instance of an Image from a java.awt.Image.
|
static Image | getInstance(PdfWriter writer, Image awtImage, float quality)
Gets an instance of a Image from a java.awt.Image.
|
static Image | getInstance(PdfContentByte cb, Image awtImage, float quality)
Gets an instance of a Image from a java.awt.Image.
|
static Image | getInstance(PRIndirectReference ref)
Reuses an existing image. |
static Image | getInstance(Image image)
gets an instance of an Image
|
static Image | getInstance(Properties attributes)
Returns an Image that has been constructed taking in
account the value of some attributes .
|
PdfOCG | getLayer()
Gets the layer this image belongs to.
|
Long | getMySerialId()
Returns a serial id for the Image (reuse the same image more than once)
|
byte[] | getOriginalData()
Getter for property originalData.
|
int | getOriginalType()
Getter for property originalType.
|
float | getPlainHeight()
Gets the plain height of the image.
|
float | getPlainWidth()
Gets the plain width of the image.
|
byte[] | getRawData()
Gets the raw data for the image.
|
float | getScaledHeight()
Gets the scaled height of the image.
|
float | getScaledWidth()
Gets the scaled width of the image.
|
protected static Long | getSerialId() Creates a new serial id. |
float | getSpacingAfter()
Gets the spacing before this image.
|
float | getSpacingBefore()
Gets the spacing before this image.
|
PdfTemplate | getTemplateData()
Gets the template to be used as an image.
|
int[] | getTransparency()
Returns the transparency.
|
URL | getUrl()
Gets the String -representation of the reference to the
image.
|
float | getWidthPercentage()
Getter for property widthPercentage.
|
float | getXYRatio()
Gets the X/Y pixel dimensionless aspect ratio.
|
boolean | hasAbsolutePosition()
Checks if the Images has to be added at an absolute
position.
|
boolean | hasAbsoluteX()
Checks if the Images has to be added at an absolute X
position.
|
boolean | hasAbsoluteY()
Checks if the Images has to be added at an absolute
position.
|
boolean | hasICCProfile()
Checks is the image has an ICC profile.
|
float | indentationLeft()
Gets the left indentation.
|
float | indentationRight()
Gets the right indentation.
|
boolean | isDeflated()
Getter for property deflated.
|
boolean | isImgRaw()
Returns true if the image is a ImgRaw
-object.
|
boolean | isImgTemplate()
Returns true if the image is an ImgTemplate
-object.
|
boolean | isInterpolation()
Getter for property interpolation.
|
boolean | isInverted()
Getter for the inverted value
|
boolean | isInvertMask()
Returns true if the bits are to be inverted in the mask.
|
boolean | isJpeg()
Returns true if the image is a Jpeg
-object.
|
boolean | isMask()
Returns true if this Image is a mask.
|
boolean | isMaskCandidate()
Returns true if this Image has the
requisites to be a mask.
|
boolean | isSmask()
Getter for property smask.
|
void | makeMask()
Make this Image a mask.
|
float[] | matrix()
Returns the transformation matrix of the image.
|
float | plainHeight()
Gets the plain height of the image.
|
float | plainWidth()
Gets the plain width of the image.
|
byte[] | rawData()
Gets the raw data for the image.
|
void | scaleAbsolute(float newWidth, float newHeight)
Scale the image to an absolute width and an absolute height.
|
void | scaleAbsoluteHeight(float newHeight)
Scale the image to an absolute height.
|
void | scaleAbsoluteWidth(float newWidth)
Scale the image to an absolute width.
|
float | scaledHeight()
Gets the scaled height of the image.
|
float | scaledWidth()
Gets the scaled height of the image.
|
void | scalePercent(float percent)
Scale the image to a certain percentage.
|
void | scalePercent(float percentX, float percentY)
Scale the width and height of an image to a certain percentage.
|
void | scaleToFit(float fitWidth, float fitHeight)
Scales the image so that it fits a certain width and height.
|
void | setAbsolutePosition(float absoluteX, float absoluteY)
Sets the absolute position of the Image .
|
void | setAdditional(PdfDictionary additional)
Sets the /Colorspace key.
|
void | setAlignment(int alignment)
Sets the alignment for the image.
|
void | setAlt(String alt)
Sets the alternative information for the image.
|
void | setAnnotation(Annotation annotation)
Sets the annotation of this Image.
|
void | setDeflated(boolean deflated)
Setter for property deflated.
|
void | setDirectReference(PdfIndirectReference directReference)
Setter for property directReference. |
void | setDpi(int dpiX, int dpiY)
Sets the dots per inch value
|
void | setImageMask(Image mask)
Sets the explicit masking.
|
void | setIndentationLeft(float f)
Sets the left indentation.
|
void | setIndentationRight(float f)
Sets the right indentation.
|
void | setInitialRotation(float initialRotation)
Some image formats, like TIFF may present the images rotated that have
to be compensated. |
void | setInterpolation(boolean interpolation)
Sets the image interpolation. |
void | setInverted(boolean invert)
Sets inverted true or false
|
void | setInvertMask(boolean invert)
Inverts the meaning of the bits of a mask.
|
void | setLayer(PdfOCG layer)
Sets the layer this image belongs to.
|
void | setOriginalData(byte[] originalData)
Setter for property originalData.
|
void | setOriginalType(int originalType)
Setter for property originalType.
|
void | setRotation(float r)
Sets the rotation of the image in radians.
|
void | setRotationDegrees(float deg)
Sets the rotation of the image in degrees.
|
void | setSmask(boolean smask)
Setter for property smask.
|
void | setSpacingAfter(float spacing)
Sets the spacing after this image.
|
void | setSpacingBefore(float spacing)
Sets the spacing before this image.
|
void | setTemplateData(PdfTemplate template)
Sets data from a PdfTemplate
|
void | setTransparency(int[] transparency)
Sets the transparency values
|
void | setUrl(URL url)
Sets the url of the image
|
void | setWidthPercentage(float widthPercentage)
Setter for property widthPercentage.
|
void | setXYRatio(float XYRatio)
Sets the X/Y pixel dimensionless aspect ratio.
|
void | simplifyColorspace()
Replaces CalRGB and CalGray colorspaces with DeviceRGB and DeviceGray. |
PdfObject | simplifyColorspace(PdfObject obj)
Gets a PDF Name from an array or returns the object that was passed. |
float | spacingAfter()
Gets the spacing before this image.
|
float | spacingBefore()
Gets the spacing before this image.
|
void | tagICC(ICC_Profile profile)
Tags this image with an ICC profile.
|
PdfTemplate | templateData()
Gets the template to be used as an image.
|
int | type()
Returns the type.
|
URL | url()
Gets the String -representation of the reference to the
image.
|
Image
-object, using an url .
Parameters: url
the URL
where the image can be found.
Image
-object, using an url .
Parameters: image another Image object.
Deprecated: Use getAbsoluteX instead
Returns the absolute X position.Returns: a position
Deprecated: Use getAbsoluteY instead
Returns the absolute Y position.Returns: a position
Deprecated: Use getAlignment instead
Gets the alignment for the image.Returns: a value
Deprecated: Use getAlt instead
Gets the alternative text for the image.Returns: a String
Deprecated: Use getAnnotation instead
Gets the annotation.Returns: the annotation that is linked to this image
Deprecated: Use getBpc instead
Gets the bpc for the image.
Remark: this only makes sense for Images of the type RawImage
.
Returns: a bpc value
Deprecated: Use getColorspace instead
Gets the colorspace for the image.
Remark: this only makes sense for Images of the type Jpeg
.
Returns: a colorspace value
Returns: a position
Returns: a position
Returns: a PdfDictionary with additional information.
Returns: a value
Returns: a String
Returns: the annotation that is linked to this image
Remark: this only makes sense for Images of the type RawImage
.
Returns: a bpc value
Remark: this only makes sense for Images of the type Jpeg
.
Returns: a colorspace value
Returns: Value of property directReference.
Returns: the dots-per-inch in the X direction
Returns: the dots-per-inch in the Y direction
Returns: the ICC profile
Returns: the explicit masking
Returns: the current image rotation in radians
Returns: the left indentation
Returns: the right indentation
Returns: Value of property initialRotation.
Parameters: url an URL
Returns: an Image
Throws: BadElementException MalformedURLException IOException
Parameters: filename a filename
Returns: an object of type Gif
,Jpeg
or
Png
Throws: BadElementException MalformedURLException IOException
Parameters: imgb raw image date
Returns: an Image object
Throws: BadElementException MalformedURLException IOException
Parameters: width the width of the image in pixels height the height of the image in pixels components 1,3 or 4 for GrayScale, RGB and CMYK data the image data bpc bits per component
Returns: an object of type ImgRaw
Throws: BadElementException on error
Parameters: width
the exact width of the image height
the exact height of the image reverseBits
reverses the bits in data
. Bit 0 is swapped
with bit 7 and so on typeCCITT
the type of compression in data
. It can be
CCITTG4, CCITTG31D, CCITTG32D parameters
parameters associated with this stream. Possible values are
CCITT_BLACKIS1, CCITT_ENCODEDBYTEALIGN, CCITT_ENDOFLINE and
CCITT_ENDOFBLOCK or a combination of them data
the image data
Returns: an Image object
Throws: BadElementException on error
Parameters: width
the exact width of the image height
the exact height of the image reverseBits
reverses the bits in data
. Bit 0 is swapped
with bit 7 and so on typeCCITT
the type of compression in data
. It can be
CCITTG4, CCITTG31D, CCITTG32D parameters
parameters associated with this stream. Possible values are
CCITT_BLACKIS1, CCITT_ENCODEDBYTEALIGN, CCITT_ENDOFLINE and
CCITT_ENDOFBLOCK or a combination of them data
the image data transparency
transparency information in the Mask format of the image
dictionary
Returns: an Image object
Throws: BadElementException on error
Parameters: width the width of the image in pixels height the height of the image in pixels components 1,3 or 4 for GrayScale, RGB and CMYK data the image data bpc bits per component transparency transparency information in the Mask format of the image dictionary
Returns: an object of type ImgRaw
Throws: BadElementException on error
Parameters: template a PdfTemplate that has to be wrapped in an Image object
Returns: an Image object
Throws: BadElementException
Parameters: image
the java.awt.Image
to convert color
if different from null
the transparency pixels
are replaced by this color forceBW
if true
the image is treated as black and white
Returns: an object of type ImgRaw
Throws: BadElementException on error IOException on error
Parameters: image
the java.awt.Image
to convert color
if different from null
the transparency pixels
are replaced by this color
Returns: an object of type ImgRaw
Throws: BadElementException on error IOException on error
Parameters: writer
the PdfWriter
object to which the image will be added awtImage
the java.awt.Image
to convert quality
a float value between 0 and 1
Returns: an object of type PdfTemplate
Throws: BadElementException on error IOException
Parameters: cb
the PdfContentByte
object to which the image will be added awtImage
the java.awt.Image
to convert quality
a float value between 0 and 1
Returns: an object of type PdfTemplate
Throws: BadElementException on error IOException
Parameters: ref the reference to the image dictionary
Returns: the image
Throws: BadElementException on error
Parameters: image an Image object
Returns: a new Image object
Deprecated: use ElementFactory.getImage(attributes)
Returns anImage
that has been constructed taking in
account the value of some attributes .
Parameters: attributes Some attributes
Returns: an Image
Throws: BadElementException MalformedURLException IOException
Returns: the layer this image belongs to or null
for no
layer defined
Returns: a serialId
Returns: Value of property originalData.
Returns: Value of property originalType.
Returns: a value
Returns: a value
Remark: this only makes sense for Images of the type RawImage
.
Returns: the raw data
Returns: a value
Returns: a value
Returns: the spacing
Returns: the spacing
Remark: this only makes sense for Images of the type ImgTemplate
.
Returns: the template
Returns: the transparency values
String
-representation of the reference to the
image.
Returns: a String
Returns: Value of property widthPercentage.
Returns: the X/Y pixel dimensionless aspect ratio
Deprecated: Use hasAbsoluteY instead
Checks if theImages
has to be added at an absolute
position.
Returns: a boolean
Images
has to be added at an absolute X
position.
Returns: a boolean
Images
has to be added at an absolute
position.
Returns: a boolean
Returns: the ICC profile or null
Deprecated: Use getIndentationLeft instead
Gets the left indentation.Returns: the left indentation
Deprecated: Use getIndentationRight instead
Gets the right indentation.Returns: the right indentation
Returns: Value of property deflated.
true
if the image is a ImgRaw
-object.
Returns: a boolean
true
if the image is an ImgTemplate
-object.
Returns: a boolean
Returns: Value of property interpolation.
Returns: true if the image is inverted
Deprecated: use isInvert()
Returnstrue
if the bits are to be inverted in the mask.
Returns: true
if the bits are to be inverted in the mask
true
if the image is a Jpeg
-object.
Returns: a boolean
true
if this Image
is a mask.
Returns: true
if this Image
is a mask
true
if this Image
has the
requisites to be a mask.
Returns: true
if this Image
can be a mask
Returns: Value of property smask.
Image
a mask.
Throws: DocumentException
if this Image
can not be a mask
Returns: an array [AX, AY, BX, BY, CX, CY, DX, DY]
Deprecated: Use getPlainHeight instead
Gets the plain height of the image.Returns: a value
Deprecated: Use getPlainWidth instead
Gets the plain width of the image.Returns: a value
Deprecated: Use getRawData instead
Gets the raw data for the image.
Remark: this only makes sense for Images of the type RawImage
.
Returns: the raw data
Parameters: newWidth the new width newHeight the new height
Parameters: newHeight the new height
Parameters: newWidth the new width
Deprecated: Use getScaledHeight instead
Gets the scaled height of the image.Returns: a value
Deprecated: Use getScaledWidth instead
Gets the scaled height of the image.Returns: a value
Parameters: percent the scaling percentage
Parameters: percentX the scaling percentage of the width percentY the scaling percentage of the height
Parameters: fitWidth the width to fit fitHeight the height to fit
Image
.
Parameters: absoluteX absoluteY
Parameters: additional a PdfDictionary with additional information.
Parameters: alignment the alignment
Parameters: alt the alternative information
Parameters: annotation the annotation
Parameters: deflated New value of property deflated.
Parameters: directReference New value of property directReference.
Parameters: dpiX dpi for x coordinates dpiY dpi for y coordinates
Parameters: mask the mask to be applied
Throws: DocumentException on error
Parameters: f
Parameters: f
Parameters: initialRotation New value of property initialRotation.
Parameters: interpolation New value of property interpolation.
Parameters: invert true or false
Deprecated: use setInverted
Inverts the meaning of the bits of a mask.Parameters: invert
true
to invert the meaning of the bits of a
mask
Parameters: layer the layer this image belongs to
Parameters: originalData New value of property originalData.
Parameters: originalType New value of property originalType.
Parameters: r rotation in radians
Parameters: deg rotation in degrees
Parameters: smask New value of property smask.
Parameters: spacing the new spacing
Parameters: spacing the new spacing
Parameters: template the template with the content
Parameters: transparency the transparency values
Parameters: url the url of the image
Parameters: widthPercentage New value of property widthPercentage.
Parameters: XYRatio the X/Y pixel dimensionless aspect ratio
Deprecated: Use getSpacingAfter instead
Gets the spacing before this image.Returns: the spacing
Deprecated: Use getSpacingBefore instead
Gets the spacing before this image.Returns: the spacing
Parameters: profile the profile
Deprecated: Use getTemplateData instead
Gets the template to be used as an image.
Remark: this only makes sense for Images of the type ImgTemplate
.
Returns: the template
Returns: a type
Deprecated: Use getUrl instead
Gets theString
-representation of the reference to the
image.
Returns: a String