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.
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.
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.
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.
LEFT
public static final int LEFT
this is a kind of image alignment.
MIDDLE
public static final int MIDDLE
this is a kind of image alignment.
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_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
RIGHT
public static final int RIGHT
this is a kind of image alignment.
TEXTWRAP
public static final int TEXTWRAP
this is a kind of image alignment.
UNDERLYING
public static final int UNDERLYING
this is a kind of image alignment.
XYRatio
private float XYRatio
Holds value of property XYRatio.
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.
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
this is the bits per component of the raw image. It also flags a CCITT
image.
colorspace
protected int colorspace
this is the colorspace of a jpeg-image.
deflated
protected boolean deflated
Holds value of property deflated.
directReference
private PdfIndirectReference directReference
Holds value of property directReference.
dpiX
protected int dpiX
Holds value of property dpiX.
dpiY
protected int dpiY
Holds value of property dpiY.
excUri
private static String excUri
excUriEsc
private static String[] excUriEsc
imageMask
protected Image imageMask
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
markupAttributes
protected Properties markupAttributes
Contains extra markupAttributes
mask
protected boolean mask
mySerialId
protected Long mySerialId
originalData
protected byte[] originalData
Holds value of property originalData.
originalType
protected int originalType
Holds value of property originalType.
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.
rotation
protected float rotation
This is the rotation of the image.
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
(package private) static long serialId
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 imagetype.
url
protected URL url
The URL of the image.
widthPercentage
private float widthPercentage
Holds value of property widthPercentage.
absoluteX
public float absoluteX()
Returns the absolute X position.
absoluteY
public float absoluteY()
Returns the absolute Y position.
alignment
public int alignment()
Gets the alignment for the image.
alt
public String alt()
Gets the alternative text for the image.
annotation
public Annotation annotation()
Gets the annotation.
- the annotation that is linked to this image
bpc
public int bpc()
Gets the bpc for the image.
Remark: this only makes sense for Images of the type
RawImage
.
colorspace
public int colorspace()
Gets the colorspace for the image.
Remark: this only makes sense for Images of the type
Jpeg
.
getAdditional
public PdfDictionary getAdditional()
Getter for property indexed.
- Value of property indexed.
getDirectReference
public PdfIndirectReference getDirectReference()
Getter for property directReference.
- Value of property directReference.
getDpiX
public int getDpiX()
Gets the dots-per-inch in the X direction. Returns 0 if not available.
- 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.
- the dots-per-inch in the Y direction
getICCProfile
public ICC_Profile getICCProfile()
Gets the images ICC profile.
getImageMask
public Image getImageMask()
Gets the explicit masking.
getImageRotation
public float getImageRotation()
Gets the current image rotation in radians.
- the current image rotation in radians
getInitialRotation
public float getInitialRotation()
Getter for property initialRotation.
- Value of property initialRotation.
getInstance
public static Image getInstance(Properties attributes)
throws BadElementException,
MalformedURLException,
IOException
Returns an Image
that has been constructed taking in
account the value of some attributes .
attributes
- Some attributes
getInstance
public static Image getInstance(String filename)
throws BadElementException,
MalformedURLException,
IOException
Gets an instance of an Image.
- an object of type
Gif
,Jpeg
or
Png
getInstance
public static Image getInstance(URL url)
throws BadElementException,
MalformedURLException,
IOException
Gets an instance of an Image.
getInstance
public static Image getInstance(Image image)
gets an instance of an Image
getInstance
public static Image getInstance(PdfContentByte cb,
java.awt.Image awtImage,
float quality)
throws BadElementException,
IOException
Gets an instance of a Image from a java.awt.Image.
The image is added as a JPEG with a userdefined quality.
cb
- the PdfContentByte
object to which the image will be addedawtImage
- the java.awt.Image
to convertquality
- a float value between 0 and 1
- an object of type
PdfTemplate
getInstance
public static Image getInstance(PdfTemplate template)
throws BadElementException
gets an instance of an Image
template
- a PdfTemplate that has to be wrapped in an Image object
getInstance
public static Image getInstance(PdfWriter writer,
java.awt.Image awtImage,
float quality)
throws BadElementException,
IOException
Gets an instance of a Image from a java.awt.Image.
The image is added as a JPEG with a userdefined quality.
writer
- the PdfWriter
object to which the image will be addedawtImage
- the java.awt.Image
to convertquality
- a float value between 0 and 1
- an object of type
PdfTemplate
getInstance
public static Image getInstance(imgb[] )
throws BadElementException,
MalformedURLException,
IOException
gets an instance of an Image
getInstance
public static Image getInstance(int width,
int height,
boolean reverseBits,
int typeCCITT,
int parameters,
byte[] data)
throws BadElementException
Creates an Image with CCITT G3 or G4 compression. It assumes that the
data bytes are already compressed.
width
- the exact width of the imageheight
- the exact height of the imagereverseBits
- reverses the bits in data
. Bit 0 is swapped
with bit 7 and so ontypeCCITT
- the type of compression in data
. 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
getInstance
public static Image getInstance(int width,
int height,
boolean reverseBits,
int typeCCITT,
int parameters,
byte[] data,
transparency[] )
throws BadElementException
Creates an Image with CCITT G3 or G4 compression. It assumes that the
data bytes are already compressed.
width
- the exact width of the imageheight
- the exact height of the imagereverseBits
- reverses the bits in data
. Bit 0 is swapped
with bit 7 and so ontypeCCITT
- the type of compression in data
. 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
getInstance
public static Image getInstance(int width,
int height,
int components,
int bpc,
data[] )
throws BadElementException
Gets an instance of an Image in raw mode.
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 component
getInstance
public static Image getInstance(int width,
int height,
int components,
int bpc,
data[] ,
transparency[] )
throws BadElementException
Gets an instance of an Image in raw mode.
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 component
getInstance
public static Image getInstance(java.awt.Image image,
java.awt.Color color)
throws BadElementException,
IOException
Gets an instance of an Image from a java.awt.Image.
image
- the java.awt.Image
to convertcolor
- if different from null
the transparency pixels
are replaced by this color
getInstance
public static Image getInstance(java.awt.Image image,
java.awt.Color color,
boolean forceBW)
throws BadElementException,
IOException
Gets an instance of an Image from a java.awt.Image.
image
- the java.awt.Image
to convertcolor
- if different from null
the transparency pixels
are replaced by this colorforceBW
- if true
the image is treated as black and white
getLayer
public PdfOCG getLayer()
Gets the layer this image belongs to.
- 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)
getOriginalData
public byte[] getOriginalData()
Getter for property originalData.
- Value of property originalData.
getOriginalType
public int getOriginalType()
Getter for property originalType.
- Value of property originalType.
getSerialId
protected static Long getSerialId()
getTransparency
public int[] getTransparency()
Returns the transparency.
getWidthPercentage
public float getWidthPercentage()
Getter for property widthPercentage.
- Value of property widthPercentage.
getXYRatio
public float getXYRatio()
Gets the X/Y pixel dimensionless aspect ratio.
- the X/Y pixel dimensionless aspect ratio
hasAbsolutePosition
public boolean hasAbsolutePosition()
Checks if the Images
has to be added at an absolute
position.
hasAbsoluteX
public boolean hasAbsoluteX()
Checks if the Images
has to be added at an absolute X
position.
hasICCProfile
public boolean hasICCProfile()
Checks is the image has an ICC profile.
indentationLeft
public float indentationLeft()
Gets the left indentation.
indentationRight
public float indentationRight()
Gets the right indentation.
isDeflated
public boolean isDeflated()
Getter for property deflated.
- Value of property deflated.
isImgRaw
public boolean isImgRaw()
Returns true
if the image is a ImgRaw
-object.
isImgTemplate
public boolean isImgTemplate()
Returns true
if the image is an ImgTemplate
-object.
isInterpolation
public boolean isInterpolation()
Getter for property interpolation.
- Value of property interpolation.
isInvertMask
public boolean isInvertMask()
Returns true
if the bits are to be inverted in the mask.
true
if the bits are to be inverted in the mask
isInverted
public boolean isInverted()
Getter for the inverted value
- true if the image is inverted
isJpeg
public boolean isJpeg()
Returns true
if the image is a Jpeg
-object.
isMask
public boolean isMask()
Returns true
if this Image
is a mask.
true
if this Image
is a mask
isMaskCandidate
public boolean isMaskCandidate()
Returns true
if this Image
has the
requisites to be a mask.
true
if this Image
can be a mask
isSmask
public boolean isSmask()
Getter for property smask.
isTag
public static boolean isTag(String tag)
Checks if a given tag corresponds with this object.
- true if the tag corresponds
matrix
public float[] matrix()
Returns the transformation matrix of the image.
- an array [AX, AY, BX, BY, CX, CY, DX, DY]
plainHeight
public float plainHeight()
Gets the plain height of the image.
plainWidth
public float plainWidth()
Gets the plain width of the image.
rawData
public byte[] rawData()
Gets the raw data for the image.
Remark: this only makes sense for Images of the type
RawImage
.
scaleAbsolute
public void scaleAbsolute(float newWidth,
float newHeight)
Scale the image to an absolute width and an absolute height.
newWidth
- the new widthnewHeight
- the new height
scaleAbsoluteHeight
public void scaleAbsoluteHeight(float newHeight)
Scale the image to an absolute height.
newHeight
- the new height
scaleAbsoluteWidth
public void scaleAbsoluteWidth(float newWidth)
Scale the image to an absolute width.
scalePercent
public void scalePercent(float percent)
Scale the image to a certain percentage.
percent
- the scaling percentage
scalePercent
public void scalePercent(float percentX,
float percentY)
Scale the width and height of an image to a certain percentage.
percentX
- the scaling percentage of the widthpercentY
- 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.
fitWidth
- the width to fitfitHeight
- the height to fit
scaledHeight
public float scaledHeight()
Gets the scaled height of the image.
scaledWidth
public float scaledWidth()
Gets the scaled width of the image.
setAbsolutePosition
public void setAbsolutePosition(float absoluteX,
float absoluteY)
Sets the absolute position of the Image
.
setAdditional
public void setAdditional(PdfDictionary additional)
Sets the /Colorspace key.
additional
- New value of property indexed.
setAlignment
public void setAlignment(int alignment)
Sets the alignment for the image.
alignment
- the alignment
setAlt
public void setAlt(String alt)
Sets the alternative information for the image.
alt
- the alternative information
setAnnotation
public void setAnnotation(Annotation annotation)
Sets the annotation of this Image.
annotation
- the annotation
setDeflated
public void setDeflated(boolean deflated)
Setter for property deflated.
deflated
- New value of property deflated.
setDirectReference
public void setDirectReference(PdfIndirectReference directReference)
Setter for property directReference.
directReference
- New value of property directReference.
setDpi
public void setDpi(int dpiX,
int dpiY)
Sets the dots per inch value
dpiX
- dpi for x coordinatesdpiY
- dpi for y coordinates
setImageMask
public void setImageMask(Image mask)
throws DocumentException
Sets the explicit masking.
mask
- the mask to be applied
setIndentationLeft
public void setIndentationLeft(float f)
Sets the left indentation.
setIndentationRight
public void setIndentationRight(float f)
Sets the right indentation.
setInitialRotation
public void setInitialRotation(float initialRotation)
Some image formats, like TIFF may present the images rotated that have
to be compensated.
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.
interpolation
- New value of property interpolation.
setInvertMask
public void setInvertMask(boolean invert)
Inverts the meaning of the bits of a mask.
invert
- true
to invert the meaning of the bits of a
mask
setInverted
public void setInverted(boolean invert)
Sets inverted true or false
setLayer
public void setLayer(PdfOCG layer)
Sets the layer this image belongs to.
layer
- the layer this image belongs to
setOriginalData
public void setOriginalData(byte[] originalData)
Setter for property originalData.
originalData
- New value of property originalData.
setOriginalType
public void setOriginalType(int originalType)
Setter for property originalType.
originalType
- New value of property originalType.
setRotation
public void setRotation(float r)
Sets the rotation of the image in radians.
setRotationDegrees
public void setRotationDegrees(float deg)
Sets the rotation of the image in degrees.
deg
- rotation in degrees
setSmask
public void setSmask(boolean smask)
Setter for property smask.
smask
- New value of property smask.
setSpacingAfter
public void setSpacingAfter(float spacing)
Sets the spacing after this image.
spacing
- the new spacing
setSpacingBefore
public void setSpacingBefore(float spacing)
Sets the spacing before this image.
spacing
- the new spacing
setTemplateData
public void setTemplateData(PdfTemplate template)
Sets data from a PdfTemplate
template
- the template with the content
setTransparency
public void setTransparency(transparency[] )
Sets the transparency values
setUrl
public void setUrl(URL url)
Sets the url of the image
url
- the url of the image
setWidthPercentage
public void setWidthPercentage(float widthPercentage)
Setter for property widthPercentage.
widthPercentage
- New value of property widthPercentage.
setXYRatio
public void setXYRatio(float XYRatio)
Sets the X/Y pixel dimensionless aspect ratio.
XYRatio
- the X/Y pixel dimensionless aspect ratio
simplifyColorspace
public void simplifyColorspace()
Replaces CalRGB and CalGray colorspaces with DeviceRGB and DeviceGray.
skip
public static void skip(InputStream is,
int size)
throws IOException
This method is an alternative for the InputStream.skip()
-method that doesn't seem to work properly for big values of size
.
is
- the InputStream
size
- the number of bytes to skip
spacingAfter
public float spacingAfter()
Gets the spacing before this image.
spacingBefore
public float spacingBefore()
Gets the spacing before this image.
tagICC
public void tagICC(ICC_Profile profile)
Tags this image with an ICC profile.
templateData
public PdfTemplate templateData()
Gets the template to be used as an image.
Remark: this only makes sense for Images of the type
ImgTemplate
.
toURL
public static URL toURL(String filename)
throws MalformedURLException
This method makes a valid URL from a given filename.
This method makes the conversion of this library from the JAVA 2 platform
to a JDK1.1.x-version easier.
filename
- a given filename
unEscapeURL
public static String unEscapeURL(String src)
Unescapes an URL. All the "%xx" are replaced by the 'xx' hex char value.
src
- the url to unescape
url
public URL url()
Gets the String
-representation of the reference to the
image.