Class Image
java.lang.Object
com.aowagie.text.Rectangle
com.aowagie.text.Image
- All Implemented Interfaces:
Element
An
Image is the representation of a graphic element (JPEG, PNG
or GIF) that has to be inserted into the document- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate floatThis is the absolute X-position of the image.private floatThis is the absolute Y-position of the image.private PdfDictionarya dictionary with additional informationprivate intThe alignment of the Image.private StringText that can be shown instead of the image.private Annotationif the annotation is not null the image will be clickable.private static final intThis represents a coordinate in the transformation matrix.private static final intThis represents a coordinate in the transformation matrix.protected intThe bits per component of the raw image.private static final intThis represents a coordinate in the transformation matrix.private static final intThis represents a coordinate in the transformation matrix.protected intthis is the colorspace of a jpeg-image.private intThe compression level of the content streams.static final intThis represents a coordinate in the transformation matrix.static final intThis represents a coordinate in the transformation matrix.private static final intthis is a kind of image alignment.private booleanHolds value of property deflated.private PdfIndirectReferenceHolds value of property directReference.protected intHolds value of property dpiX.protected intHolds value of property dpiY.private static final intThis represents a coordinate in the transformation matrix.private static final intThis represents a coordinate in the transformation matrix.private ImageThe image that serves as a mask for this image.private floatthe indentation to the left.private floatthe indentation to the right.private floatHolds value of property initialRotation.private booleanHolds value of property interpolation.protected booleanImage color inversionprivate PdfOCGOptional Content layer to which we want this Image to belong.static final intthis is a kind of image alignment.private booleanIs this image a mask?static final intthis is a kind of image alignment.private Longan iText attributed unique id for this image.static final inttype of imagestatic final inttype of image(package private) static final inttype of image(package private) static final inttype of image(package private) static final inttype of imageprivate static final inttype of imagestatic final inttype of imagestatic final inttype of image(package private) static final inttype of imageprotected byte[]Holds value of property originalData.protected intHolds value of property originalType.protected floatThis is the width of the image without rotation.protected floatThis is the width of the image without rotation.private ICC_ProfileICC Profile attachedprotected byte[]The raw data of the image.static final intthis is a kind of image alignment.private floatThis is the rotation of the image in radians.protected floatThis is the original height of the image taking rotation into account.protected floatThis is the scaled width of the image taking rotation into account.private static longa static that is used for attributing a unique id to each image.private booleanHolds value of property smask.private floatThe spacing after the image.private floatThe spacing before the image.private PdfTemplate[]The template to be treated as an image.static final intthis is a kind of image alignment.private int[]this is the transparency information of the raw imageprotected intThe image type.static final intthis is a kind of image alignment.protected URLThe URL of the image.private floatHolds value of property widthPercentage.private floatHolds value of property XYRatio.Fields inherited from class Rectangle
border, borderWidth, BOTTOM, BOX, llx, lly, NO_BORDER, rotation, TOP, UNDEFINED, urx, uryFields inherited from interface 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, JBIG2, JPEG, JPEG2000, KEYWORDS, LIST, LISTITEM, MARKED, MULTI_COLUMN_TEXT, PARAGRAPH, PHRASE, PRODUCER, PTABLE, RECTANGLE, ROW, SECTION, SUBJECT, TABLE, TITLE, YMARK -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloatReturns the absolute X position.floatReturns the absolute Y position.Getter for the dictionary with additional information.intGets the alignment for the image.getAlt()Gets the alternative text for the image.Gets the annotation.intgetBpc()Gets the bpc for the image.intGets the colorspace for the image.intReturns the compression level used for images written as a compressed stream.Getter for property directReference.intgetDpiX()Gets the dots-per-inch in the X direction.intgetDpiY()Gets the dots-per-inch in the Y direction.Gets the images ICC profile.Gets the explicit masking.floatGets the current image rotation in radians.floatGets the left indentation.floatGets the right indentation.floatGetter for property initialRotation.static ImagegetInstance(byte[] imgb) gets an instance of an Imagestatic ImagegetInstance(int width, int height, boolean reverseBits, int typeCCITT, int parameters, byte[] data) Creates an Image with CCITT G3 or G4 compression.private 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) Gets an instance of an Image in raw mode.private 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(Image image) gets an instance of an Imagestatic ImagegetInstance(PdfTemplate template) gets an instance of an Imagestatic ImagegetInstance(Image image, Color color) Gets an instance of an Image from a java.awt.Image.static ImagegetInstance(Image image, Color color, boolean forceBW) Gets an instance of an Image from a java.awt.Image.static ImagegetInstance(String filename) Gets an instance of an Image.private static ImagegetInstance(URL url) Gets an instance of an Image.getLayer()Gets the layer this image belongs to.Returns a serial id for the Image (reuse the same image more than once)byte[]Getter for property originalData.intGetter for property originalType.floatGets the plain height of the image.floatGets the plain width of the image.byte[]Gets the raw data for the image.floatGets the scaled height of the image.floatGets the scaled width of the image.private static LongCreates a new serial id.floatGets the spacing before this image.floatGets the spacing before this image.Gets the template to be used as an image.int[]Returns the transparency.getUrl()Gets theString-representation of the reference to the image.floatGetter for property widthPercentage.floatGets the X/Y pixel dimensionless aspect ratio.booleanChecks if theImageshas to be added at an absolute X position.booleanChecks if theImageshas to be added at an absolute position.booleanChecks is the image has an ICC profile.booleanGetter for property deflated.booleanisImgRaw()Returnstrueif the image is aImgRaw-object.booleanReturnstrueif the image is anImgTemplate-object.booleanGetter for property interpolation.booleanGetter for the inverted valuebooleanisJpeg()Returnstrueif the image is aJpeg-object.booleanisMask()Returnstrueif thisImageis a mask.booleanReturnstrueif thisImagehas the requisites to be a mask.booleanChecks if this element is nestable.booleanisSmask()Getter for property smask.voidmakeMask()Make thisImagea 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.private 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 theImage.voidsetAdditional(PdfDictionary additional) Sets the /Colorspace key.voidsetAlignment(int alignment) Sets the alignment for the image.voidSets 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 valuevoidsetImageMask(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 falsevoidSets 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 PdfTemplatevoidsetTransparency(int[] transparency) Sets the transparency valuesvoidSets the url of the imagevoidsetWidthPercentage(float widthPercentage) Setter for property widthPercentage.voidsetXYRatio(float XYRatio) Sets the X/Y pixel dimensionless aspect ratio.private PdfObjectGets 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.Methods inherited from class Rectangle
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, toString
-
Field Details
-
DEFAULT
private static final int DEFAULTthis is a kind of image alignment.- See Also:
-
RIGHT
public static final int RIGHTthis is a kind of image alignment.- See Also:
-
LEFT
public static final int LEFTthis is a kind of image alignment.- See Also:
-
MIDDLE
public static final int MIDDLEthis is a kind of image alignment.- See Also:
-
TEXTWRAP
public static final int TEXTWRAPthis is a kind of image alignment.- See Also:
-
UNDERLYING
public static final int UNDERLYINGthis is a kind of image alignment.- See Also:
-
AX
private static final int AXThis represents a coordinate in the transformation matrix.- See Also:
-
AY
private static final int AYThis represents a coordinate in the transformation matrix.- See Also:
-
BX
private static final int BXThis represents a coordinate in the transformation matrix.- See Also:
-
BY
private static final int BYThis represents a coordinate in the transformation matrix.- See Also:
-
CX
public static final int CXThis represents a coordinate in the transformation matrix.- See Also:
-
CY
public static final int CYThis represents a coordinate in the transformation matrix.- See Also:
-
DX
private static final int DXThis represents a coordinate in the transformation matrix.- See Also:
-
DY
private static final int DYThis represents a coordinate in the transformation matrix.- See Also:
-
ORIGINAL_NONE
private static final int ORIGINAL_NONEtype of image- See Also:
-
ORIGINAL_JPEG
static final int ORIGINAL_JPEGtype of image- See Also:
-
ORIGINAL_PNG
public static final int ORIGINAL_PNGtype of image- See Also:
-
ORIGINAL_GIF
public static final int ORIGINAL_GIFtype of image- See Also:
-
ORIGINAL_BMP
public static final int ORIGINAL_BMPtype of image- See Also:
-
ORIGINAL_TIFF
public static final int ORIGINAL_TIFFtype of image- See Also:
-
ORIGINAL_WMF
static final int ORIGINAL_WMFtype of image- See Also:
-
ORIGINAL_JPEG2000
static final int ORIGINAL_JPEG2000type of image- See Also:
-
ORIGINAL_JBIG2
static final int ORIGINAL_JBIG2type of image- Since:
- 2.1.5
- See Also:
-
type
protected int typeThe image type. -
url
The URL of the image. -
rawData
protected byte[] rawDataThe raw data of the image. -
bpc
protected int bpcThe bits per component of the raw image. It also flags a CCITT image. -
template
The template to be treated as an image. -
alignment
private int alignmentThe alignment of the Image. -
alt
Text that can be shown instead of the image. -
absoluteX
private float absoluteXThis is the absolute X-position of the image. -
absoluteY
private float absoluteYThis is the absolute Y-position of the image. -
plainWidth
protected float plainWidthThis is the width of the image without rotation. -
plainHeight
protected float plainHeightThis is the width of the image without rotation. -
scaledWidth
protected float scaledWidthThis is the scaled width of the image taking rotation into account. -
scaledHeight
protected float scaledHeightThis is the original height of the image taking rotation into account. -
compressionLevel
private int compressionLevelThe compression level of the content streams.- Since:
- 2.1.3
-
mySerialId
an iText attributed unique id for this image. -
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. -
serialId
private static long serialIda static that is used for attributing a unique id to each image. -
rotationRadians
private float rotationRadiansThis is the rotation of the image in radians. -
initialRotation
private float initialRotationHolds value of property initialRotation. -
indentationLeft
private float indentationLeftthe indentation to the left. -
indentationRight
private float indentationRightthe indentation to the right. -
spacingBefore
private float spacingBeforeThe spacing before the image. -
spacingAfter
private float spacingAfterThe spacing after the image. -
widthPercentage
private float widthPercentageHolds value of property widthPercentage. -
annotation
if the annotation is not null the image will be clickable. -
layer
Optional Content layer to which we want this Image to belong. -
interpolation
private boolean interpolationHolds value of property interpolation. -
originalType
protected int originalTypeHolds value of property originalType. -
originalData
protected byte[] originalDataHolds value of property originalData. -
deflated
private boolean deflatedHolds value of property deflated. -
dpiX
protected int dpiXHolds value of property dpiX. -
dpiY
protected int dpiYHolds value of property dpiY. -
XYRatio
private float XYRatioHolds value of property XYRatio. -
colorspace
protected int colorspacethis is the colorspace of a jpeg-image. -
invert
protected boolean invertImage color inversion -
profile
ICC Profile attached -
additional
a dictionary with additional information -
mask
private boolean maskIs this image a mask? -
imageMask
The image that serves as a mask for this image. -
smask
private boolean smaskHolds value of property smask. -
transparency
private int[] transparencythis is the transparency information of the raw image
-
-
Constructor Details
-
Image
Image(URL url) Constructs anImage-object, using an url .- Parameters:
url- theURLwhere the image can be found.
-
Image
Constructs anImage-object, using an url .- Parameters:
image- another Image object.
-
-
Method Details
-
getInstance
private static Image getInstance(URL url) throws BadElementException, MalformedURLException, IOException Gets an instance of an Image.- Parameters:
url- an URL- Returns:
- an Image
- Throws:
BadElementException- on errorMalformedURLException- on errorIOException- on error
-
getInstance
public static Image getInstance(String filename) throws BadElementException, MalformedURLException, IOException Gets an instance of an Image.- Parameters:
filename- a filename- Returns:
- an object of type
Gif,JpegorPng - Throws:
BadElementException- on errorMalformedURLException- on errorIOException- on error
-
getInstance
public static Image getInstance(byte[] imgb) throws BadElementException, MalformedURLException, IOException gets an instance of an Image- Parameters:
imgb- raw image date- Returns:
- an Image object
- Throws:
BadElementException- on errorMalformedURLException- on errorIOException- on error
-
getInstance
public static Image getInstance(int width, int height, int components, int bpc, byte[] data) throws BadElementException Gets an instance of an Image in raw mode.- Parameters:
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 componentdata- the image data- 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) throws BadElementException 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 imageheight- the exact height of the imagereverseBits- reverses the bits indata. Bit 0 is swapped with bit 7 and so ontypeCCITT- the type of compression indata. 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- Returns:
- an Image object
- Throws:
BadElementException- on error
-
getInstance
private static Image getInstance(int width, int height, boolean reverseBits, int typeCCITT, int parameters, byte[] data, int[] transparency) throws BadElementException 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 imageheight- the exact height of the imagereverseBits- reverses the bits indata. Bit 0 is swapped with bit 7 and so ontypeCCITT- the type of compression indata. 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- Returns:
- an Image object
- Throws:
BadElementException- on error
-
getInstance
private static Image getInstance(int width, int height, int components, int bpc, byte[] data, int[] transparency) throws BadElementException Gets an instance of an Image in raw mode.- Parameters:
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 componentdata- the image datatransparency- transparency information in the Mask format of the image dictionary- Returns:
- an object of type
ImgRaw - Throws:
BadElementException- on error
-
getInstance
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- on error
-
getInstance
public static Image getInstance(Image image, Color color, boolean forceBW) throws BadElementException, IOException Gets an instance of an Image from a java.awt.Image.- Parameters:
image- thejava.awt.Imageto convertcolor- if different fromnullthe transparency pixels are replaced by this colorforceBW- iftruethe image is treated as black and white- Returns:
- an object of type
ImgRaw - Throws:
BadElementException- on errorIOException- on error
-
getInstance
Gets an instance of an Image from a java.awt.Image.- Parameters:
image- thejava.awt.Imageto convertcolor- if different fromnullthe transparency pixels are replaced by this color- Returns:
- an object of type
ImgRaw - Throws:
BadElementException- on errorIOException- on error
-
getDirectReference
Getter for property directReference.- Returns:
- Value of property directReference.
-
setDirectReference
Setter for property directReference.- Parameters:
directReference- New value of property directReference.
-
getInstance
-
type
-
isNestable
public boolean isNestable()Description copied from interface:ElementChecks if this element is nestable.- Specified by:
isNestablein interfaceElement- Overrides:
isNestablein classRectangle- Returns:
- true if this element can be nested inside other elements.
- Since:
- iText 2.0.8
- See Also:
-
isJpeg
public boolean isJpeg()Returnstrueif the image is aJpeg-object.- Returns:
- a
boolean
-
isImgRaw
public boolean isImgRaw()Returnstrueif the image is aImgRaw-object.- Returns:
- a
boolean
-
isImgTemplate
public boolean isImgTemplate()Returnstrueif the image is anImgTemplate-object.- Returns:
- a
boolean
-
getUrl
Gets theString-representation of the reference to the image.- Returns:
- a
String
-
setUrl
-
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
-
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
-
getTemplateData
Gets the template to be used as an image.Remark: this only makes sense for Images of the type
ImgTemplate.- Returns:
- the template
-
setTemplateData
Sets data from a PdfTemplate- Parameters:
template- the template with the content
-
getAlignment
public int getAlignment()Gets the alignment for the image.- Returns:
- a value
-
setAlignment
public void setAlignment(int alignment) Sets the alignment for the image.- Parameters:
alignment- the alignment
-
getAlt
-
setAlt
Sets the alternative information for the image.- Parameters:
alt- the alternative information
-
setAbsolutePosition
public void setAbsolutePosition(float absoluteX, float absoluteY) Sets the absolute position of theImage.- Parameters:
absoluteX- XabsoluteY- Y
-
hasAbsoluteX
public boolean hasAbsoluteX()Checks if theImageshas to be added at an absolute X position.- Returns:
- a boolean
-
getAbsoluteX
public float getAbsoluteX()Returns the absolute X position.- Returns:
- a position
-
hasAbsoluteY
public boolean hasAbsoluteY()Checks if theImageshas to be added at an absolute position.- Returns:
- a boolean
-
getAbsoluteY
public float getAbsoluteY()Returns the absolute Y position.- Returns:
- a position
-
getScaledWidth
public float getScaledWidth()Gets the scaled width of the image.- Returns:
- a value
-
getScaledHeight
public float getScaledHeight()Gets the scaled height of the image.- Returns:
- a value
-
getPlainWidth
public float getPlainWidth()Gets the plain width of the image.- Returns:
- a value
-
getPlainHeight
public float getPlainHeight()Gets the plain height of the image.- Returns:
- a value
-
scaleAbsolute
public void scaleAbsolute(float newWidth, float newHeight) Scale the image to an absolute width and an absolute height.- Parameters:
newWidth- the new widthnewHeight- the new height
-
scaleAbsoluteWidth
public void scaleAbsoluteWidth(float newWidth) Scale the image to an absolute width.- Parameters:
newWidth- the new width
-
scaleAbsoluteHeight
public void scaleAbsoluteHeight(float newHeight) Scale the image to an absolute height.- Parameters:
newHeight- the new height
-
scalePercent
public void scalePercent(float percent) Scale the image to a certain percentage.- Parameters:
percent- the scaling percentage
-
scalePercent
private 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 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.- Parameters:
fitWidth- the width to fitfitHeight- the height to fit
-
matrix
public float[] matrix()Returns the transformation matrix of the image.- Returns:
- an array [AX, AY, BX, BY, CX, CY, DX, DY]
-
getSerialId
-
getMySerialId
Returns a serial id for the Image (reuse the same image more than once)- Returns:
- a serialId
-
getImageRotation
public float getImageRotation()Gets the current image rotation in radians.- Returns:
- the current image rotation in radians
-
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
-
getInitialRotation
public float getInitialRotation()Getter for property initialRotation.- Returns:
- Value of property initialRotation.
-
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.
-
getIndentationLeft
public float getIndentationLeft()Gets the left indentation.- Returns:
- the left indentation
-
setIndentationLeft
public void setIndentationLeft(float f) Sets the left indentation.- Parameters:
f- Identation
-
getIndentationRight
public float getIndentationRight()Gets the right indentation.- Returns:
- the right indentation
-
setIndentationRight
public void setIndentationRight(float f) Sets the right indentation.- Parameters:
f- Identation
-
getSpacingBefore
public float getSpacingBefore()Gets the spacing before this image.- Returns:
- the spacing
-
setSpacingBefore
public void setSpacingBefore(float spacing) Sets the spacing before this image.- Parameters:
spacing- the new spacing
-
getSpacingAfter
public float getSpacingAfter()Gets the spacing before this image.- Returns:
- the spacing
-
setSpacingAfter
public void setSpacingAfter(float spacing) Sets the spacing after this image.- Parameters:
spacing- the new spacing
-
getWidthPercentage
public float getWidthPercentage()Getter for property widthPercentage.- Returns:
- Value of property widthPercentage.
-
setWidthPercentage
public void setWidthPercentage(float widthPercentage) Setter for property widthPercentage.- Parameters:
widthPercentage- New value of property widthPercentage.
-
setAnnotation
Sets the annotation of this Image.- Parameters:
annotation- the annotation
-
getAnnotation
Gets the annotation.- Returns:
- the annotation that is linked to this image
-
getLayer
Gets the layer this image belongs to.- Returns:
- the layer this image belongs to or
nullfor no layer defined
-
setLayer
Sets the layer this image belongs to.- Parameters:
layer- the layer this image belongs to
-
isInterpolation
public boolean isInterpolation()Getter for property interpolation.- Returns:
- Value of property interpolation.
-
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.
-
getOriginalType
public int getOriginalType()Getter for property originalType.- Returns:
- Value of property originalType.
-
setOriginalType
public void setOriginalType(int originalType) Setter for property originalType.- Parameters:
originalType- New value of property originalType.
-
getOriginalData
public byte[] getOriginalData()Getter for property originalData.- Returns:
- Value of property originalData.
-
setOriginalData
public void setOriginalData(byte[] originalData) Setter for property originalData.- Parameters:
originalData- New value of property originalData.
-
isDeflated
public boolean isDeflated()Getter for property deflated.- Returns:
- Value of property deflated.
-
setDeflated
public void setDeflated(boolean deflated) Setter for property deflated.- Parameters:
deflated- New value of property deflated.
-
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
-
setDpi
public void setDpi(int dpiX, int dpiY) Sets the dots per inch value- Parameters:
dpiX- dpi for x coordinatesdpiY- dpi for y coordinates
-
getXYRatio
public float getXYRatio()Gets the X/Y pixel dimensionless aspect ratio.- Returns:
- the X/Y pixel dimensionless aspect ratio
-
setXYRatio
public void setXYRatio(float XYRatio) Sets the X/Y pixel dimensionless aspect ratio.- Parameters:
XYRatio- the X/Y pixel dimensionless aspect ratio
-
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
-
isInverted
public boolean isInverted()Getter for the inverted value- Returns:
- true if the image is inverted
-
setInverted
public void setInverted(boolean invert) Sets inverted true or false- Parameters:
invert- true or false
-
tagICC
Tags this image with an ICC profile.- Parameters:
profile- the profile
-
hasICCProfile
public boolean hasICCProfile()Checks is the image has an ICC profile.- Returns:
- the ICC profile or
null
-
getICCProfile
-
getAdditional
Getter for the dictionary with additional information.- Returns:
- a PdfDictionary with additional information.
-
setAdditional
Sets the /Colorspace key.- Parameters:
additional- a PdfDictionary with additional information.
-
simplifyColorspace
-
isMask
public boolean isMask()Returnstrueif thisImageis a mask.- Returns:
trueif thisImageis a mask
-
makeMask
Make thisImagea mask.- Throws:
DocumentException- if thisImagecan not be a mask
-
isMaskCandidate
public boolean isMaskCandidate()Returnstrueif thisImagehas the requisites to be a mask.- Returns:
trueif thisImagecan be a mask
-
getImageMask
-
setImageMask
Sets the explicit masking.- Parameters:
mask- the mask to be applied- Throws:
DocumentException- on error
-
isSmask
public boolean isSmask()Getter for property smask.- Returns:
- Value of property smask.
-
setSmask
public void setSmask(boolean smask) Setter for property smask.- Parameters:
smask- New value of property smask.
-
getTransparency
public int[] getTransparency()Returns the transparency.- Returns:
- the transparency values
-
setTransparency
public void setTransparency(int[] transparency) Sets the transparency values- Parameters:
transparency- the transparency values
-
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
-
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
-