com.lowagie.text

Class Image

public abstract class Image extends Rectangle

An Image is the representation of a graphic element (JPEG, PNG or GIF) that has to be inserted into the document

See Also: Element Rectangle

Field Summary
static intAX
This represents a coordinate in the transformation matrix.
static intAY
This represents a coordinate in the transformation matrix.
protected floatabsoluteX
This is the absolute X-position of the image.
protected floatabsoluteY
This is the absolute Y-position of the image.
PdfDictionaryadditional
a dictionary with additional information
protected intalignment
The alignment of the Image.
protected Stringalt
Text that can be shown instead of the image.
protected Annotationannotation
if the annotation is not null the image will be clickable.
protected intbpc
The bits per component of the raw image.
static intBX
This represents a coordinate in the transformation matrix.
static intBY
This represents a coordinate in the transformation matrix.
protected intcolorspace
this is the colorspace of a jpeg-image.
protected intcompressionLevel
The compression level of the content streams.
static intCX
This represents a coordinate in the transformation matrix.
static intCY
This represents a coordinate in the transformation matrix.
protected booleandeflated
Holds value of property deflated.
PdfIndirectReferencedirectReference
Holds value of property directReference.
protected intdpiX
Holds value of property dpiX.
protected intdpiY
Holds value of property dpiY.
static intDEFAULT
this is a kind of image alignment.
static intDX
This represents a coordinate in the transformation matrix.
static intDY
This represents a coordinate in the transformation matrix.
protected ImageimageMask
The image that serves as a mask for this image.
protected floatindentationLeft
the indentation to the left.
protected floatindentationRight
the indentation to the right.
floatinitialRotation
Holds value of property initialRotation.
protected booleaninterpolation
Holds value of property interpolation.
protected booleaninvert
Image color inversion
protected PdfOCGlayer
Optional Content layer to which we want this Image to belong.
static intLEFT
this is a kind of image alignment.
protected booleanmask
Is this image a mask?
protected LongmySerialId
an iText attributed unique id for this image.
static intMIDDLE
this is a kind of image alignment.
protected byte[]originalData
Holds value of property originalData.
protected intoriginalType
Holds value of property originalType.
static intORIGINAL_BMP
type of image
static intORIGINAL_GIF
type of image
static intORIGINAL_JPEG
type of image
static intORIGINAL_JPEG2000
type of image
static intORIGINAL_NONE
type of image
static intORIGINAL_PNG
type of image
static intORIGINAL_PS
type of image
static intORIGINAL_TIFF
type of image
static intORIGINAL_WMF
type of image
protected floatplainHeight
This is the width of the image without rotation.
protected floatplainWidth
This is the width of the image without rotation.
protected ICC_Profileprofile
ICC Profile attached
protected byte[]rawData
The raw data of the image.
protected floatrotationRadians
This is the rotation of the image in radians.
static intRIGHT
this is a kind of image alignment.
protected floatscaledHeight
This is the original height of the image taking rotation into account.
protected floatscaledWidth
This is the scaled width of the image taking rotation into account.
static longserialId
a static that is used for attributing a unique id to each image.
booleansmask
Holds value of property smask.
protected floatspacingAfter
The spacing after the image.
protected floatspacingBefore
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 inttype
The image type.
static intTEXTWRAP
this is a kind of image alignment.
protected URLurl
The URL of the image.
static intUNDERLYING
this is a kind of image alignment.
floatwidthPercentage
Holds value of property widthPercentage.
floatXYRatio
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
floatgetAbsoluteX()
Returns the absolute X position.
floatgetAbsoluteY()
Returns the absolute Y position.
PdfDictionarygetAdditional()
Getter for the dictionary with additional information.
intgetAlignment()
Gets the alignment for the image.
StringgetAlt()
Gets the alternative text for the image.
AnnotationgetAnnotation()
Gets the annotation.
intgetBpc()
Gets the bpc for the image.
intgetColorspace()
Gets the colorspace for the image.
intgetCompressionLevel()
Returns the compression level used for images written as a compressed stream.
PdfIndirectReferencegetDirectReference()
Getter for property directReference.
intgetDpiX()
Gets the dots-per-inch in the X direction.
intgetDpiY()
Gets the dots-per-inch in the Y direction.
ICC_ProfilegetICCProfile()
Gets the images ICC profile.
ImagegetImageMask()
Gets the explicit masking.
floatgetImageRotation()
Gets the current image rotation in radians.
floatgetIndentationLeft()
Gets the left indentation.
floatgetIndentationRight()
Gets the right indentation.
floatgetInitialRotation()
Getter for property initialRotation.
static ImagegetInstance(URL url)
Gets an instance of an Image.
static ImagegetInstance(String filename)
Gets an instance of an Image.
static ImagegetInstance(byte[] imgb)
gets an instance of an Image
static ImagegetInstance(int width, int height, int components, int bpc, byte[] data)
Gets an instance of an Image in raw mode.
static ImagegetInstance(int width, int height, boolean reverseBits, int typeCCITT, int parameters, byte[] data)
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)
Creates an Image with CCITT G3 or G4 compression.
static ImagegetInstance(int width, int height, int components, int bpc, byte[] data, int[] transparency)
Gets an instance of an Image in raw mode.
static ImagegetInstance(PdfTemplate template)
gets an instance of an Image
static ImagegetInstance(Image image, Color color, boolean forceBW)
Gets an instance of an Image from a java.awt.Image.
static ImagegetInstance(Image image, Color color)
Gets an instance of an Image from a java.awt.Image.
static ImagegetInstance(PdfWriter writer, Image awtImage, float quality)
Gets an instance of a Image from a java.awt.Image.
static ImagegetInstance(PdfContentByte cb, Image awtImage, float quality)
Gets an instance of a Image from a java.awt.Image.
static ImagegetInstance(PRIndirectReference ref)
Reuses an existing image.
static ImagegetInstance(Image image)
gets an instance of an Image
PdfOCGgetLayer()
Gets the layer this image belongs to.
LonggetMySerialId()
Returns a serial id for the Image (reuse the same image more than once)
byte[]getOriginalData()
Getter for property originalData.
intgetOriginalType()
Getter for property originalType.
floatgetPlainHeight()
Gets the plain height of the image.
floatgetPlainWidth()
Gets the plain width of the image.
byte[]getRawData()
Gets the raw data for the image.
floatgetScaledHeight()
Gets the scaled height of the image.
floatgetScaledWidth()
Gets the scaled width of the image.
protected static LonggetSerialId()
Creates a new serial id.
floatgetSpacingAfter()
Gets the spacing before this image.
floatgetSpacingBefore()
Gets the spacing before this image.
PdfTemplategetTemplateData()
Gets the template to be used as an image.
int[]getTransparency()
Returns the transparency.
URLgetUrl()
Gets the String -representation of the reference to the image.
floatgetWidthPercentage()
Getter for property widthPercentage.
floatgetXYRatio()
Gets the X/Y pixel dimensionless aspect ratio.
booleanhasAbsoluteX()
Checks if the Images has to be added at an absolute X position.
booleanhasAbsoluteY()
Checks if the Images has to be added at an absolute position.
booleanhasICCProfile()
Checks is the image has an ICC profile.
booleanisDeflated()
Getter for property deflated.
booleanisImgRaw()
Returns true if the image is a ImgRaw -object.
booleanisImgTemplate()
Returns true if the image is an ImgTemplate -object.
booleanisInterpolation()
Getter for property interpolation.
booleanisInverted()
Getter for the inverted value
booleanisJpeg()
Returns true if the image is a Jpeg -object.
booleanisMask()
Returns true if this Image is a mask.
booleanisMaskCandidate()
Returns true if this Image has the requisites to be a mask.
booleanisNestable()
booleanisSmask()
Getter for property smask.
voidmakeMask()
Make this Image a mask.
float[]matrix()
Returns the transformation matrix of the image.
voidscaleAbsolute(float newWidth, float newHeight)
Scale the image to an absolute width and an absolute height.
voidscaleAbsoluteHeight(float newHeight)
Scale the image to an absolute height.
voidscaleAbsoluteWidth(float newWidth)
Scale the image to an absolute width.
voidscalePercent(float percent)
Scale the image to a certain percentage.
voidscalePercent(float percentX, float percentY)
Scale the width and height of an image to a certain percentage.
voidscaleToFit(float fitWidth, float fitHeight)
Scales the image so that it fits a certain width and height.
voidsetAbsolutePosition(float absoluteX, float absoluteY)
Sets the absolute position of the Image.
voidsetAdditional(PdfDictionary additional)
Sets the /Colorspace key.
voidsetAlignment(int alignment)
Sets the alignment for the image.
voidsetAlt(String alt)
Sets the alternative information for the image.
voidsetAnnotation(Annotation annotation)
Sets the annotation of this Image.
voidsetCompressionLevel(int compressionLevel)
Sets the compression level to be used if the image is written as a compressed stream.
voidsetDeflated(boolean deflated)
Setter for property deflated.
voidsetDirectReference(PdfIndirectReference directReference)
Setter for property directReference.
voidsetDpi(int dpiX, int dpiY)
Sets the dots per inch value
voidsetImageMask(Image mask)
Sets the explicit masking.
voidsetIndentationLeft(float f)
Sets the left indentation.
voidsetIndentationRight(float f)
Sets the right indentation.
voidsetInitialRotation(float initialRotation)
Some image formats, like TIFF may present the images rotated that have to be compensated.
voidsetInterpolation(boolean interpolation)
Sets the image interpolation.
voidsetInverted(boolean invert)
Sets inverted true or false
voidsetLayer(PdfOCG layer)
Sets the layer this image belongs to.
voidsetOriginalData(byte[] originalData)
Setter for property originalData.
voidsetOriginalType(int originalType)
Setter for property originalType.
voidsetRotation(float r)
Sets the rotation of the image in radians.
voidsetRotationDegrees(float deg)
Sets the rotation of the image in degrees.
voidsetSmask(boolean smask)
Setter for property smask.
voidsetSpacingAfter(float spacing)
Sets the spacing after this image.
voidsetSpacingBefore(float spacing)
Sets the spacing before this image.
voidsetTemplateData(PdfTemplate template)
Sets data from a PdfTemplate
voidsetTransparency(int[] transparency)
Sets the transparency values
voidsetUrl(URL url)
Sets the url of the image
voidsetWidthPercentage(float widthPercentage)
Setter for property widthPercentage.
voidsetXYRatio(float XYRatio)
Sets the X/Y pixel dimensionless aspect ratio.
voidsimplifyColorspace()
Replaces CalRGB and CalGray colorspaces with DeviceRGB and DeviceGray.
PdfObjectsimplifyColorspace(PdfObject obj)
Gets a PDF Name from an array or returns the object that was passed.
voidtagICC(ICC_Profile profile)
Tags this image with an ICC profile.
inttype()
Returns the type.

Field Detail

AX

public static final int AX
This represents a coordinate in the transformation matrix.

AY

public static final int AY
This represents a coordinate in the transformation matrix.

absoluteX

protected float absoluteX
This is the absolute X-position of the image.

absoluteY

protected float absoluteY
This is the absolute Y-position of the image.

additional

private PdfDictionary additional
a dictionary with additional information

alignment

protected int alignment
The alignment of the Image.

alt

protected String alt
Text that can be shown instead of the image.

annotation

protected Annotation annotation
if the annotation is not null the image will be clickable.

bpc

protected int bpc
The bits per component of the raw image. It also flags a CCITT image.

BX

public static final int BX
This represents a coordinate in the transformation matrix.

BY

public static final int BY
This represents a coordinate in the transformation matrix.

colorspace

protected int colorspace
this is the colorspace of a jpeg-image.

compressionLevel

protected int compressionLevel
The compression level of the content streams.

Since: 2.1.3

CX

public static final int CX
This represents a coordinate in the transformation matrix.

CY

public static final int CY
This represents a coordinate in the transformation matrix.

deflated

protected boolean deflated
Holds value of property deflated.

directReference

private PdfIndirectReference directReference
Holds value of property directReference. An image is embedded into a PDF as an Image XObject. This object is referenced by a PdfIndirectReference object.

dpiX

protected int dpiX
Holds value of property dpiX.

dpiY

protected int dpiY
Holds value of property dpiY.

DEFAULT

public static final int DEFAULT
this is a kind of image alignment.

DX

public static final int DX
This represents a coordinate in the transformation matrix.

DY

public static final int DY
This represents a coordinate in the transformation matrix.

imageMask

protected Image imageMask
The image that serves as a mask for this image.

indentationLeft

protected float indentationLeft
the indentation to the left.

indentationRight

protected float indentationRight
the indentation to the right.

initialRotation

private float initialRotation
Holds value of property initialRotation.

interpolation

protected boolean interpolation
Holds value of property interpolation.

invert

protected boolean invert
Image color inversion

layer

protected PdfOCG layer
Optional Content layer to which we want this Image to belong.

LEFT

public static final int LEFT
this is a kind of image alignment.

mask

protected boolean mask
Is this image a mask?

mySerialId

protected Long mySerialId
an iText attributed unique id for this image.

MIDDLE

public static final int MIDDLE
this is a kind of image alignment.

originalData

protected byte[] originalData
Holds value of property originalData.

originalType

protected int originalType
Holds value of property originalType.

ORIGINAL_BMP

public static final int ORIGINAL_BMP
type of image

ORIGINAL_GIF

public static final int ORIGINAL_GIF
type of image

ORIGINAL_JPEG

public static final int ORIGINAL_JPEG
type of image

ORIGINAL_JPEG2000

public static final int ORIGINAL_JPEG2000
type of image

ORIGINAL_NONE

public static final int ORIGINAL_NONE
type of image

ORIGINAL_PNG

public static final int ORIGINAL_PNG
type of image

ORIGINAL_PS

public static final int ORIGINAL_PS
type of image

ORIGINAL_TIFF

public static final int ORIGINAL_TIFF
type of image

ORIGINAL_WMF

public static final int ORIGINAL_WMF
type of image

plainHeight

protected float plainHeight
This is the width of the image without rotation.

plainWidth

protected float plainWidth
This is the width of the image without rotation.

profile

protected ICC_Profile profile
ICC Profile attached

rawData

protected byte[] rawData
The raw data of the image.

rotationRadians

protected float rotationRadians
This is the rotation of the image in radians.

RIGHT

public static final int RIGHT
this is a kind of image alignment.

scaledHeight

protected float scaledHeight
This is the original height of the image taking rotation into account.

scaledWidth

protected float scaledWidth
This is the scaled width of the image taking rotation into account.

serialId

static long serialId
a static that is used for attributing a unique id to each image.

smask

private boolean smask
Holds value of property smask.

spacingAfter

protected float spacingAfter
The spacing after the image.

spacingBefore

protected float spacingBefore
The spacing before the image.

template

protected PdfTemplate[] template
The template to be treated as an image.

transparency

protected int[] transparency
this is the transparency information of the raw image

type

protected int type
The image type.

TEXTWRAP

public static final int TEXTWRAP
this is a kind of image alignment.

url

protected URL url
The URL of the image.

UNDERLYING

public static final int UNDERLYING
this is a kind of image alignment.

widthPercentage

private float widthPercentage
Holds value of property widthPercentage.

XYRatio

private float XYRatio
Holds value of property XYRatio.

Constructor Detail

Image

public Image(URL url)
Constructs an Image -object, using an url .

Parameters: url the URL where the image can be found.

Image

protected Image(Image image)
Constructs an Image -object, using an url .

Parameters: image another Image object.

Method Detail

getAbsoluteX

public float getAbsoluteX()
Returns the absolute X position.

Returns: a position

getAbsoluteY

public float getAbsoluteY()
Returns the absolute Y position.

Returns: a position

getAdditional

public PdfDictionary getAdditional()
Getter for the dictionary with additional information.

Returns: a PdfDictionary with additional information.

getAlignment

public int getAlignment()
Gets the alignment for the image.

Returns: a value

getAlt

public String getAlt()
Gets the alternative text for the image.

Returns: a String

getAnnotation

public Annotation getAnnotation()
Gets the annotation.

Returns: the annotation that is linked to this image

getBpc

public int getBpc()
Gets the bpc for the image.

Remark: this only makes sense for Images of the type RawImage .

Returns: a bpc value

getColorspace

public int getColorspace()
Gets the colorspace for the image.

Remark: this only makes sense for Images of the type Jpeg.

Returns: a colorspace value

getCompressionLevel

public int getCompressionLevel()
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

getDirectReference

public PdfIndirectReference getDirectReference()
Getter for property directReference.

Returns: Value of property directReference.

getDpiX

public int getDpiX()
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()
Gets the dots-per-inch in the Y direction. Returns 0 if not available.

Returns: the dots-per-inch in the Y direction

getICCProfile

public ICC_Profile getICCProfile()
Gets the images ICC profile.

Returns: the ICC profile

getImageMask

public Image getImageMask()
Gets the explicit masking.

Returns: the explicit masking

getImageRotation

public float getImageRotation()
Gets the current image rotation in radians.

Returns: the current image rotation in radians

getIndentationLeft

public float getIndentationLeft()
Gets the left indentation.

Returns: the left indentation

getIndentationRight

public float getIndentationRight()
Gets the right indentation.

Returns: the right indentation

getInitialRotation

public float getInitialRotation()
Getter for property initialRotation.

Returns: Value of property initialRotation.

getInstance

public static Image getInstance(URL url)
Gets an instance of an Image.

Parameters: url an URL

Returns: an Image

Throws: BadElementException MalformedURLException IOException

getInstance

public static Image getInstance(String filename)
Gets an instance of an Image.

Parameters: filename a filename

Returns: an object of type Gif,Jpeg or Png

Throws: BadElementException MalformedURLException IOException

getInstance

public static Image getInstance(byte[] imgb)
gets an instance of an Image

Parameters: imgb raw image date

Returns: an Image object

Throws: BadElementException MalformedURLException IOException

getInstance

public static Image getInstance(int width, int height, int components, int bpc, byte[] data)
Gets an instance of an Image in raw mode.

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

getInstance

public static Image getInstance(int width, int height, boolean reverseBits, int typeCCITT, int parameters, byte[] data)
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 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

getInstance

public 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. It assumes that the data bytes are already compressed.

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

getInstance

public static Image getInstance(int width, int height, int components, int bpc, byte[] data, int[] transparency)
Gets an instance of an Image in raw mode.

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

getInstance

public static Image getInstance(PdfTemplate template)
gets an instance of an Image

Parameters: template a PdfTemplate that has to be wrapped in an Image object

Returns: an Image object

Throws: BadElementException

getInstance

public static Image getInstance(Image image, Color color, boolean forceBW)
Gets an instance of an Image from a java.awt.Image.

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

getInstance

public static Image getInstance(Image image, Color color)
Gets an instance of an Image from a java.awt.Image.

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

getInstance

public static Image getInstance(PdfWriter writer, Image awtImage, float quality)
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 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

getInstance

public static Image getInstance(PdfContentByte cb, Image awtImage, float quality)
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 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

getInstance

public static Image getInstance(PRIndirectReference ref)
Reuses an existing image.

Parameters: ref the reference to the image dictionary

Returns: the image

Throws: BadElementException on error

getInstance

public static Image getInstance(Image image)
gets an instance of an Image

Parameters: image an Image object

Returns: a new Image object

getLayer

public PdfOCG getLayer()
Gets the layer this image belongs to.

Returns: the layer this image belongs to or null for no layer defined

getMySerialId

public Long getMySerialId()
Returns a serial id for the Image (reuse the same image more than once)

Returns: a serialId

getOriginalData

public byte[] getOriginalData()
Getter for property originalData.

Returns: Value of property originalData.

getOriginalType

public int getOriginalType()
Getter for property originalType.

Returns: Value of property originalType.

getPlainHeight

public float getPlainHeight()
Gets the plain height of the image.

Returns: a value

getPlainWidth

public float getPlainWidth()
Gets the plain width of the image.

Returns: a value

getRawData

public byte[] getRawData()
Gets the raw data for the image.

Remark: this only makes sense for Images of the type RawImage .

Returns: the raw data

getScaledHeight

public float getScaledHeight()
Gets the scaled height of the image.

Returns: a value

getScaledWidth

public float getScaledWidth()
Gets the scaled width of the image.

Returns: a value

getSerialId

protected static Long getSerialId()
Creates a new serial id.

getSpacingAfter

public float getSpacingAfter()
Gets the spacing before this image.

Returns: the spacing

getSpacingBefore

public float getSpacingBefore()
Gets the spacing before this image.

Returns: the spacing

getTemplateData

public PdfTemplate getTemplateData()
Gets the template to be used as an image.

Remark: this only makes sense for Images of the type ImgTemplate .

Returns: the template

getTransparency

public int[] getTransparency()
Returns the transparency.

Returns: the transparency values

getUrl

public URL getUrl()
Gets the String -representation of the reference to the image.

Returns: a String

getWidthPercentage

public float getWidthPercentage()
Getter for property widthPercentage.

Returns: Value of property widthPercentage.

getXYRatio

public float getXYRatio()
Gets the X/Y pixel dimensionless aspect ratio.

Returns: the X/Y pixel dimensionless aspect ratio

hasAbsoluteX

public boolean hasAbsoluteX()
Checks if the Images has to be added at an absolute X position.

Returns: a boolean

hasAbsoluteY

public boolean hasAbsoluteY()
Checks if the Images has to be added at an absolute position.

Returns: a boolean

hasICCProfile

public boolean hasICCProfile()
Checks is the image has an ICC profile.

Returns: the ICC profile or null

isDeflated

public boolean isDeflated()
Getter for property deflated.

Returns: Value of property deflated.

isImgRaw

public boolean isImgRaw()
Returns true if the image is a ImgRaw -object.

Returns: a boolean

isImgTemplate

public boolean isImgTemplate()
Returns true if the image is an ImgTemplate -object.

Returns: a boolean

isInterpolation

public boolean isInterpolation()
Getter for property interpolation.

Returns: Value of property interpolation.

isInverted

public boolean isInverted()
Getter for the inverted value

Returns: true if the image is inverted

isJpeg

public boolean isJpeg()
Returns true if the image is a Jpeg -object.

Returns: a boolean

isMask

public boolean isMask()
Returns true if this Image is a mask.

Returns: true if this Image is a mask

isMaskCandidate

public boolean isMaskCandidate()
Returns true if this Image has the requisites to be a mask.

Returns: true if this Image can be a mask

isNestable

public boolean isNestable()

Since: iText 2.0.8

See Also: isNestable

isSmask

public boolean isSmask()
Getter for property smask.

Returns: Value of property smask.

makeMask

public void makeMask()
Make this Image a mask.

Throws: DocumentException if this Image can not be a mask

matrix

public float[] matrix()
Returns the transformation matrix of the image.

Returns: an array [AX, AY, BX, BY, CX, CY, DX, DY]

scaleAbsolute

public void scaleAbsolute(float newWidth, float newHeight)
Scale the image to an absolute width and an absolute height.

Parameters: newWidth the new width newHeight the new height

scaleAbsoluteHeight

public void scaleAbsoluteHeight(float newHeight)
Scale the image to an absolute height.

Parameters: newHeight the new height

scaleAbsoluteWidth

public void scaleAbsoluteWidth(float newWidth)
Scale the image to an absolute width.

Parameters: newWidth the new width

scalePercent

public void scalePercent(float percent)
Scale the image to a certain percentage.

Parameters: percent the scaling percentage

scalePercent

public void scalePercent(float percentX, float percentY)
Scale the width and height of an image to a certain percentage.

Parameters: percentX the scaling percentage of the width percentY the scaling percentage of the height

scaleToFit

public void scaleToFit(float fitWidth, float fitHeight)
Scales the image so that it fits a certain width and height.

Parameters: fitWidth the width to fit fitHeight the height to fit

setAbsolutePosition

public void setAbsolutePosition(float absoluteX, float absoluteY)
Sets the absolute position of the Image.

Parameters: absoluteX absoluteY

setAdditional

public void setAdditional(PdfDictionary additional)
Sets the /Colorspace key.

Parameters: additional a PdfDictionary with additional information.

setAlignment

public void setAlignment(int alignment)
Sets the alignment for the image.

Parameters: alignment the alignment

setAlt

public void setAlt(String alt)
Sets the alternative information for the image.

Parameters: alt the alternative information

setAnnotation

public void setAnnotation(Annotation annotation)
Sets the annotation of this Image.

Parameters: annotation the annotation

setCompressionLevel

public void setCompressionLevel(int compressionLevel)
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

setDeflated

public void setDeflated(boolean deflated)
Setter for property deflated.

Parameters: deflated New value of property deflated.

setDirectReference

public void setDirectReference(PdfIndirectReference directReference)
Setter for property directReference.

Parameters: directReference New value of property directReference.

setDpi

public void setDpi(int dpiX, int dpiY)
Sets the dots per inch value

Parameters: dpiX dpi for x coordinates dpiY dpi for y coordinates

setImageMask

public void setImageMask(Image mask)
Sets the explicit masking.

Parameters: mask the mask to be applied

Throws: DocumentException on error

setIndentationLeft

public void setIndentationLeft(float f)
Sets the left indentation.

Parameters: f

setIndentationRight

public void setIndentationRight(float f)
Sets the right indentation.

Parameters: f

setInitialRotation

public void setInitialRotation(float initialRotation)
Some image formats, like TIFF may present the images rotated that have to be compensated.

Parameters: initialRotation New value of property initialRotation.

setInterpolation

public void setInterpolation(boolean interpolation)
Sets the image interpolation. Image interpolation attempts to produce a smooth transition between adjacent sample values.

Parameters: interpolation New value of property interpolation.

setInverted

public void setInverted(boolean invert)
Sets inverted true or false

Parameters: invert true or false

setLayer

public void setLayer(PdfOCG layer)
Sets the layer this image belongs to.

Parameters: layer the layer this image belongs to

setOriginalData

public void setOriginalData(byte[] originalData)
Setter for property originalData.

Parameters: originalData New value of property originalData.

setOriginalType

public void setOriginalType(int originalType)
Setter for property originalType.

Parameters: originalType New value of property originalType.

setRotation

public void setRotation(float r)
Sets the rotation of the image in radians.

Parameters: r rotation in radians

setRotationDegrees

public void setRotationDegrees(float deg)
Sets the rotation of the image in degrees.

Parameters: deg rotation in degrees

setSmask

public void setSmask(boolean smask)
Setter for property smask.

Parameters: smask New value of property smask.

setSpacingAfter

public void setSpacingAfter(float spacing)
Sets the spacing after this image.

Parameters: spacing the new spacing

setSpacingBefore

public void setSpacingBefore(float spacing)
Sets the spacing before this image.

Parameters: spacing the new spacing

setTemplateData

public void setTemplateData(PdfTemplate template)
Sets data from a PdfTemplate

Parameters: template the template with the content

setTransparency

public void setTransparency(int[] transparency)
Sets the transparency values

Parameters: transparency the transparency values

setUrl

public void setUrl(URL url)
Sets the url of the image

Parameters: url the url of the image

setWidthPercentage

public void setWidthPercentage(float widthPercentage)
Setter for property widthPercentage.

Parameters: widthPercentage New value of property widthPercentage.

setXYRatio

public void setXYRatio(float XYRatio)
Sets the X/Y pixel dimensionless aspect ratio.

Parameters: XYRatio the X/Y pixel dimensionless aspect ratio

simplifyColorspace

public void simplifyColorspace()
Replaces CalRGB and CalGray colorspaces with DeviceRGB and DeviceGray.

simplifyColorspace

private PdfObject simplifyColorspace(PdfObject obj)
Gets a PDF Name from an array or returns the object that was passed.

tagICC

public void tagICC(ICC_Profile profile)
Tags this image with an ICC profile.

Parameters: profile the profile

type

public int type()
Returns the type.

Returns: a type