|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.lowagie.text.Rectangle
com.lowagie.text.Image
An Image is the representation of a graphic element (JPEG, PNG
or GIF) that has to be inserted into the document
Element,
Rectangle| Field Summary | |
static int |
AX
This represents a coordinate in the transformation matrix. |
static int |
AY
This represents a coordinate in the transformation matrix. |
static int |
BX
This represents a coordinate in the transformation matrix. |
static int |
BY
This represents a coordinate in the transformation matrix. |
static int |
CX
This represents a coordinate in the transformation matrix. |
static int |
CY
This represents a coordinate in the transformation matrix. |
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. |
static int |
LEFT
this is a kind of image alignment. |
static int |
MIDDLE
this is a kind of image alignment. |
static int |
ORIGINAL_BMP
type of image |
static int |
ORIGINAL_GIF
type of image |
static int |
ORIGINAL_JPEG
type of image |
static int |
ORIGINAL_JPEG2000
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 |
static int |
RIGHT
this is a kind of image alignment. |
static int |
TEXTWRAP
this is a kind of image alignment. |
static int |
UNDERLYING
this is a kind of image alignment. |
| Fields inherited from class com.lowagie.text.Rectangle |
BOTTOM, BOX, NO_BORDER, TOP, UNDEFINED |
| Fields 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, HEADER, IMGRAW, IMGTEMPLATE, JPEG, JPEG2000, KEYWORDS, LIST, LISTITEM, MARKED, MULTI_COLUMN_TEXT, PARAGRAPH, PHRASE, PRODUCER, PTABLE, RECTANGLE, ROW, SECTION, SUBJECT, TABLE, TITLE, YMARK |
| Constructor Summary | |
Image(URL url)
Constructs an Image -object, using an url . |
|
| Method Summary | |
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. |
int |
getCompressionLevel()
Returns the compression level used for images written as a compressed stream. |
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(byte[] imgb)
gets an instance of an Image |
static Image |
getInstance(Image image)
gets an instance of an Image |
static Image |
getInstance(Image image,
Color color)
Gets an instance of an Image from a java.awt.Image. |
static Image |
getInstance(Image image,
Color color,
boolean forceBW)
Gets an instance of an Image from a java.awt.Image. |
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)
Gets an instance of an Image in raw mode. |
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(PdfContentByte cb,
Image awtImage,
float quality)
Gets an instance of a Image from a java.awt.Image. |
static Image |
getInstance(PdfTemplate template)
gets an instance of an Image |
static Image |
getInstance(PdfWriter writer,
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(String filename)
Gets an instance of an Image. |
static Image |
getInstance(URL url)
Gets an instance of an Image. |
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. |
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 |
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. |
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 |
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 |
isNestable()
Checks if this element is nestable. |
boolean |
isSmask()
Getter for property smask. |
void |
makeMask()
Make this Image a mask. |
float[] |
matrix()
Returns the transformation matrix of 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. |
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 |
setCompressionLevel(int compressionLevel)
Sets the compression level to be used if the image is written as a compressed stream. |
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 |
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. |
void |
tagICC(ICC_Profile profile)
Tags this image with an ICC profile. |
int |
type()
Returns the type. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int DEFAULT
public static final int RIGHT
public static final int LEFT
public static final int MIDDLE
public static final int TEXTWRAP
public static final int UNDERLYING
public static final int AX
public static final int AY
public static final int BX
public static final int BY
public static final int CX
public static final int CY
public static final int DX
public static final int DY
public static final int ORIGINAL_NONE
public static final int ORIGINAL_JPEG
public static final int ORIGINAL_PNG
public static final int ORIGINAL_GIF
public static final int ORIGINAL_BMP
public static final int ORIGINAL_TIFF
public static final int ORIGINAL_WMF
public static final int ORIGINAL_PS
public static final int ORIGINAL_JPEG2000
| Constructor Detail |
public Image(URL url)
Image -object, using an url .
url - the URL where the image can be found.| Method Detail |
public static Image getInstance(URL url)
throws BadElementException,
MalformedURLException,
IOException
url - an URL
BadElementException
MalformedURLException
IOException
public static Image getInstance(String filename)
throws BadElementException,
MalformedURLException,
IOException
filename - a filename
Gif,Jpeg or
Png
BadElementException
MalformedURLException
IOException
public static Image getInstance(byte[] imgb)
throws BadElementException,
MalformedURLException,
IOException
imgb - raw image date
BadElementException
MalformedURLException
IOException
public static Image getInstance(int width,
int height,
int components,
int bpc,
byte[] data)
throws BadElementException
width - the width of the image in pixelsheight - the height of the image in pixelscomponents - 1,3 or 4 for GrayScale, RGB and CMYKdata - the image databpc - bits per component
ImgRaw
BadElementException - on error
public static Image getInstance(int width,
int height,
boolean reverseBits,
int typeCCITT,
int parameters,
byte[] data)
throws BadElementException
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
BadElementException - on error
public static Image getInstance(int width,
int height,
boolean reverseBits,
int typeCCITT,
int parameters,
byte[] data,
int[] transparency)
throws BadElementException
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 datatransparency - transparency information in the Mask format of the image
dictionary
BadElementException - on error
public static Image getInstance(int width,
int height,
int components,
int bpc,
byte[] data,
int[] transparency)
throws BadElementException
width - the width of the image in pixelsheight - the height of the image in pixelscomponents - 1,3 or 4 for GrayScale, RGB and CMYKdata - the image databpc - bits per componenttransparency - transparency information in the Mask format of the image
dictionary
ImgRaw
BadElementException - on error
public static Image getInstance(PdfTemplate template)
throws BadElementException
template - a PdfTemplate that has to be wrapped in an Image object
BadElementException
public static Image getInstance(Image image,
Color color,
boolean forceBW)
throws BadElementException,
IOException
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
ImgRaw
BadElementException - on error
IOException - on error
public static Image getInstance(Image image,
Color color)
throws BadElementException,
IOException
image - the java.awt.Image to convertcolor - if different from null the transparency pixels
are replaced by this color
ImgRaw
BadElementException - on error
IOException - on error
public static Image getInstance(PdfWriter writer,
Image awtImage,
float quality)
throws BadElementException,
IOException
writer - the PdfWriter object to which the image will be addedawtImage - the java.awt.Image to convertquality - a float value between 0 and 1
PdfTemplate
BadElementException - on error
IOException
public static Image getInstance(PdfContentByte cb,
Image awtImage,
float quality)
throws BadElementException,
IOException
cb - the PdfContentByte object to which the image will be addedawtImage - the java.awt.Image to convertquality - a float value between 0 and 1
PdfTemplate
BadElementException - on error
IOExceptionpublic PdfIndirectReference getDirectReference()
public void setDirectReference(PdfIndirectReference directReference)
directReference - New value of property directReference.
public static Image getInstance(PRIndirectReference ref)
throws BadElementException
ref - the reference to the image dictionary
BadElementException - on errorpublic static Image getInstance(Image image)
image - an Image object
public int type()
type in interface Elementtype in class Rectanglepublic boolean isNestable()
Element
isNestable in interface ElementisNestable in class RectangleElement.isNestable()public boolean isJpeg()
true if the image is a Jpeg
-object.
booleanpublic boolean isImgRaw()
true if the image is a ImgRaw
-object.
booleanpublic boolean isImgTemplate()
true if the image is an ImgTemplate
-object.
booleanpublic URL getUrl()
String -representation of the reference to the
image.
Stringpublic void setUrl(URL url)
url - the url of the imagepublic byte[] getRawData()
Remark: this only makes sense for Images of the type RawImage
.
public int getBpc()
Remark: this only makes sense for Images of the type RawImage
.
public PdfTemplate getTemplateData()
Remark: this only makes sense for Images of the type ImgTemplate
.
public void setTemplateData(PdfTemplate template)
template - the template with the contentpublic int getAlignment()
public void setAlignment(int alignment)
alignment - the alignmentpublic String getAlt()
Stringpublic void setAlt(String alt)
alt - the alternative information
public void setAbsolutePosition(float absoluteX,
float absoluteY)
Image.
absoluteX - absoluteY - public boolean hasAbsoluteX()
Images has to be added at an absolute X
position.
public float getAbsoluteX()
public boolean hasAbsoluteY()
Images has to be added at an absolute
position.
public float getAbsoluteY()
public float getScaledWidth()
public float getScaledHeight()
public float getPlainWidth()
public float getPlainHeight()
public void scaleAbsolute(float newWidth,
float newHeight)
newWidth - the new widthnewHeight - the new heightpublic void scaleAbsoluteWidth(float newWidth)
newWidth - the new widthpublic void scaleAbsoluteHeight(float newHeight)
newHeight - the new heightpublic void scalePercent(float percent)
percent - the scaling percentage
public void scalePercent(float percentX,
float percentY)
percentX - the scaling percentage of the widthpercentY - the scaling percentage of the height
public void scaleToFit(float fitWidth,
float fitHeight)
fitWidth - the width to fitfitHeight - the height to fitpublic float[] matrix()
public Long getMySerialId()
public float getImageRotation()
public void setRotation(float r)
r - rotation in radianspublic void setRotationDegrees(float deg)
deg - rotation in degreespublic float getInitialRotation()
public void setInitialRotation(float initialRotation)
initialRotation - New value of property initialRotation.public float getIndentationLeft()
public void setIndentationLeft(float f)
f - public float getIndentationRight()
public void setIndentationRight(float f)
f - public float getSpacingBefore()
public void setSpacingBefore(float spacing)
spacing - the new spacingpublic float getSpacingAfter()
public void setSpacingAfter(float spacing)
spacing - the new spacingpublic float getWidthPercentage()
public void setWidthPercentage(float widthPercentage)
widthPercentage - New value of property widthPercentage.public void setAnnotation(Annotation annotation)
annotation - the annotationpublic Annotation getAnnotation()
public PdfOCG getLayer()
null for no
layer definedpublic void setLayer(PdfOCG layer)
layer - the layer this image belongs topublic boolean isInterpolation()
public void setInterpolation(boolean interpolation)
interpolation - New value of property interpolation.public int getOriginalType()
public void setOriginalType(int originalType)
originalType - New value of property originalType.public byte[] getOriginalData()
public void setOriginalData(byte[] originalData)
originalData - New value of property originalData.public boolean isDeflated()
public void setDeflated(boolean deflated)
deflated - New value of property deflated.public int getDpiX()
public int getDpiY()
public void setDpi(int dpiX,
int dpiY)
dpiX - dpi for x coordinatesdpiY - dpi for y coordinatespublic float getXYRatio()
public void setXYRatio(float XYRatio)
XYRatio - the X/Y pixel dimensionless aspect ratiopublic int getColorspace()
Remark: this only makes sense for Images of the type Jpeg.
public boolean isInverted()
public void setInverted(boolean invert)
invert - true or falsepublic void tagICC(ICC_Profile profile)
profile - the profilepublic boolean hasICCProfile()
nullpublic ICC_Profile getICCProfile()
public PdfDictionary getAdditional()
public void setAdditional(PdfDictionary additional)
additional - a PdfDictionary with additional information.public void simplifyColorspace()
public boolean isMask()
true if this Image is a mask.
true if this Image is a mask
public void makeMask()
throws DocumentException
Image a mask.
DocumentException - if this Image can not be a maskpublic boolean isMaskCandidate()
true if this Image has the
requisites to be a mask.
true if this Image can be a maskpublic Image getImageMask()
public void setImageMask(Image mask)
throws DocumentException
mask - the mask to be applied
DocumentException - on errorpublic boolean isSmask()
public void setSmask(boolean smask)
smask - New value of property smask.public int[] getTransparency()
public void setTransparency(int[] transparency)
transparency - the transparency valuespublic int getCompressionLevel()
public void setCompressionLevel(int compressionLevel)
compressionLevel - a value between 0 (best speed) and 9 (best compression)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||