| Modifier and Type | Field and Description |
|---|---|
protected int |
bpc
The bits per component of the raw image.
|
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 int |
dpiX
Holds value of property dpiX.
|
protected int |
dpiY
Holds value of property dpiY.
|
protected boolean |
invert
Image color inversion
|
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_PNG
type of image
|
static int |
ORIGINAL_TIFF
type of image
|
protected byte[] |
originalData
Holds value of property originalData.
|
protected int |
originalType
Holds value of property originalType.
|
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 byte[] |
rawData
The raw data of the image.
|
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 int |
TEXTWRAP
this is a kind of image alignment.
|
protected int |
type
The image type.
|
static int |
UNDERLYING
this is a kind of image alignment.
|
protected URL |
url
The URL of the image.
|
border, borderWidth, BOTTOM, BOX, llx, lly, NO_BORDER, rotation, TOP, UNDEFINED, urx, uryALIGN_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, JBIG2, JPEG, JPEG2000, KEYWORDS, LIST, LISTITEM, MARKED, MULTI_COLUMN_TEXT, PARAGRAPH, PHRASE, PRODUCER, PTABLE, RECTANGLE, ROW, SECTION, SUBJECT, TABLE, TITLE, YMARK| Modifier | Constructor and Description |
|---|---|
protected |
Image(Image image)
Constructs an
Image -object, using an url . |
| Modifier and Type | Method and Description |
|---|---|
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,
int components,
int bpc,
byte[] data)
Gets an instance of an Image in raw mode.
|
static Image |
getInstance(PdfTemplate template)
gets an instance of an Image
|
static Image |
getInstance(String filename)
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 |
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 |
tagICC(ICC_Profile profile)
Tags this image with an ICC profile.
|
int |
type()
Returns the type.
|
cloneNonPositionParameters, disableBorderSide, enableBorderSide, getBackgroundColor, getBorder, getBorderColor, getBorderColorBottom, getBorderColorLeft, getBorderColorRight, getBorderColorTop, getBorderWidth, getBorderWidthBottom, getBorderWidthLeft, getBorderWidthRight, getBorderWidthTop, getBottom, getBottom, getChunks, getGrayFill, getHeight, getLeft, getLeft, getRight, getRight, getRotation, getTop, getTop, getWidth, hasBorder, hasBorders, isContent, isUseVariableBorders, normalize, process, rectangle, rotate, setBackgroundColor, setBorder, setBorderColor, setBorderColorBottom, setBorderColorLeft, setBorderColorRight, setBorderColorTop, setBorderWidth, setBorderWidthBottom, setBorderWidthLeft, setBorderWidthRight, setBorderWidthTop, setBottom, setGrayFill, setLeft, setRight, setTop, setUseVariableBorders, softCloneNonPositionParameters, toStringpublic 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 CX
public static final int CY
public static final int ORIGINAL_PNG
public static final int ORIGINAL_GIF
public static final int ORIGINAL_BMP
public static final int ORIGINAL_TIFF
protected int type
protected URL url
protected byte[] rawData
protected int bpc
protected float plainWidth
protected float plainHeight
protected float scaledWidth
protected float scaledHeight
protected int originalType
protected byte[] originalData
protected int dpiX
protected int dpiY
protected int colorspace
protected boolean invert
protected Image(Image image)
Image -object, using an url .image - another Image object.public static Image getInstance(String filename) throws BadElementException, MalformedURLException, IOException
filename - a filenameGif,Jpeg or
PngBadElementException - on errorMalformedURLException - on errorIOException - on errorpublic static Image getInstance(byte[] imgb) throws BadElementException, MalformedURLException, IOException
imgb - raw image dateBadElementException - on errorMalformedURLException - on errorIOException - on errorpublic 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 componentImgRawBadElementException - on errorpublic 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 dataBadElementException - on errorpublic static Image getInstance(PdfTemplate template) throws BadElementException
template - a PdfTemplate that has to be wrapped in an Image objectBadElementException - on errorpublic 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 whiteImgRawBadElementException - on errorIOException - on errorpublic 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 colorImgRawBadElementException - on errorIOException - on errorpublic PdfIndirectReference getDirectReference()
public void setDirectReference(PdfIndirectReference directReference)
directReference - New value of property directReference.public static Image getInstance(Image image)
image - an Image objectpublic int type()
public boolean isNestable()
ElementisNestable 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 informationpublic void setAbsolutePosition(float absoluteX,
float absoluteY)
Image.absoluteX - XabsoluteY - Ypublic 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 percentagepublic 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 - Identationpublic float getIndentationRight()
public void setIndentationRight(float f)
f - Identationpublic 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 boolean isMask()
true if this Image is a mask.true if this Image is a maskpublic 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 appliedDocumentException - 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)Copyright © 2021. All rights reserved.