Home » iText-2.1.7 » com.lowagie » text » [javadoc | source]
com.lowagie.text
abstract public class: Image [javadoc | source]
java.lang.Object
   com.lowagie.text.Rectangle
      com.lowagie.text.Image

All Implemented Interfaces:
    Element

Direct Known Subclasses:
    ImgTemplate, Jpeg, ImgRaw, ImgPostscript, ImgWMF, ImgCCITT, Jpeg2000, ImgJBIG2, Watermark

An Image is the representation of a graphic element (JPEG, PNG or GIF) that has to be inserted into the document
Field Summary
public static final  int DEFAULT    this is a kind of image alignment. 
public static final  int RIGHT    this is a kind of image alignment. 
public static final  int LEFT    this is a kind of image alignment. 
public static final  int MIDDLE    this is a kind of image alignment. 
public static final  int TEXTWRAP    this is a kind of image alignment. 
public static final  int UNDERLYING    this is a kind of image alignment. 
public static final  int AX    This represents a coordinate in the transformation matrix. 
public static final  int AY    This represents a coordinate in the transformation matrix. 
public static final  int BX    This represents a coordinate in the transformation matrix. 
public static final  int BY    This represents a coordinate in the transformation matrix. 
public static final  int CX    This represents a coordinate in the transformation matrix. 
public static final  int CY    This represents a coordinate in the transformation matrix. 
public static final  int DX    This represents a coordinate in the transformation matrix. 
public static final  int DY    This represents a coordinate in the transformation matrix. 
public static final  int ORIGINAL_NONE    type of image 
public static final  int ORIGINAL_JPEG    type of image 
public static final  int ORIGINAL_PNG    type of image 
public static final  int ORIGINAL_GIF    type of image 
public static final  int ORIGINAL_BMP    type of image 
public static final  int ORIGINAL_TIFF    type of image 
public static final  int ORIGINAL_WMF    type of image 
public static final  int ORIGINAL_PS    type of image 
public static final  int ORIGINAL_JPEG2000    type of image 
public static final  int ORIGINAL_JBIG2    type of image
    since: 2.1.5 -
 
protected  int type    The image type. 
protected  URL url    The URL of the image. 
protected  byte[] rawData    The raw data of the image. 
protected  int bpc    The bits per component of the raw image. It also flags a CCITT image. 
protected  PdfTemplate[] template    The template to be treated as an image. 
protected  int alignment    The alignment of the Image. 
protected  String alt    Text that can be shown instead of the image. 
protected  float absoluteX    This is the absolute X-position of the image. 
protected  float absoluteY    This is the absolute Y-position of the image. 
protected  float plainWidth    This is the width of the image without rotation. 
protected  float plainHeight    This is the width of the image without rotation. 
protected  float scaledWidth    This is the scaled width of the image taking rotation into account. 
protected  float scaledHeight    This is the original height of the image taking rotation into account. 
protected  int compressionLevel    The compression level of the content streams.
    since: 2.1.3 -
 
protected  Long mySerialId    an iText attributed unique id for this image. 
static  long serialId    a static that is used for attributing a unique id to each image. 
protected  float rotationRadians    This is the rotation of the image in radians. 
protected  float indentationLeft    the indentation to the left. 
protected  float indentationRight    the indentation to the right. 
protected  float spacingBefore    The spacing before the image. 
protected  float spacingAfter    The spacing after the image. 
protected  Annotation annotation    if the annotation is not null the image will be clickable. 
protected  PdfOCG layer    Optional Content layer to which we want this Image to belong. 
protected  boolean interpolation    Holds value of property interpolation. 
protected  int originalType    Holds value of property originalType. 
protected  byte[] originalData    Holds value of property originalData. 
protected  boolean deflated    Holds value of property deflated. 
protected  int dpiX    Holds value of property dpiX. 
protected  int dpiY    Holds value of property dpiY. 
protected  int colorspace    this is the colorspace of a jpeg-image. 
protected  boolean invert    Image color inversion 
protected  ICC_Profile profile    ICC Profile attached 
protected  boolean mask    Is this image a mask? 
protected  Image imageMask    The image that serves as a mask for this image. 
protected  int[] transparency    this is the transparency information of the raw image 
Fields inherited from com.lowagie.text.Rectangle:
UNDEFINED,  TOP,  BOTTOM,  LEFT,  RIGHT,  NO_BORDER,  BOX,  llx,  lly,  urx,  ury,  rotation,  backgroundColor,  border,  useVariableBorders,  borderWidth,  borderWidthLeft,  borderWidthRight,  borderWidthTop,  borderWidthBottom,  borderColor,  borderColorLeft,  borderColorRight,  borderColorTop,  borderColorBottom
Constructor:
 public Image(URL url) 
    Constructs an Image -object, using an url .
    Parameters:
    url - the URL where the image can be found.
 protected Image(Image image) 
    Constructs an Image -object, using an url .
    Parameters:
    image - another Image object.
Method from com.lowagie.text.Image Summary:
getAbsoluteX,   getAbsoluteY,   getAdditional,   getAlignment,   getAlt,   getAnnotation,   getBpc,   getColorspace,   getCompressionLevel,   getDirectReference,   getDpiX,   getDpiY,   getICCProfile,   getImageMask,   getImageRotation,   getIndentationLeft,   getIndentationRight,   getInitialRotation,   getInstance,   getInstance,   getInstance,   getInstance,   getInstance,   getInstance,   getInstance,   getInstance,   getInstance,   getInstance,   getInstance,   getInstance,   getInstance,   getInstance,   getInstance,   getLayer,   getMySerialId,   getOriginalData,   getOriginalType,   getPlainHeight,   getPlainWidth,   getRawData,   getScaledHeight,   getScaledWidth,   getSerialId,   getSpacingAfter,   getSpacingBefore,   getTemplateData,   getTransparency,   getUrl,   getWidthPercentage,   getXYRatio,   hasAbsoluteX,   hasAbsoluteY,   hasICCProfile,   isDeflated,   isImgRaw,   isImgTemplate,   isInterpolation,   isInverted,   isJpeg,   isMask,   isMaskCandidate,   isNestable,   isSmask,   makeMask,   matrix,   scaleAbsolute,   scaleAbsoluteHeight,   scaleAbsoluteWidth,   scalePercent,   scalePercent,   scaleToFit,   setAbsolutePosition,   setAdditional,   setAlignment,   setAlt,   setAnnotation,   setCompressionLevel,   setDeflated,   setDirectReference,   setDpi,   setImageMask,   setIndentationLeft,   setIndentationRight,   setInitialRotation,   setInterpolation,   setInverted,   setLayer,   setOriginalData,   setOriginalType,   setRotation,   setRotationDegrees,   setSmask,   setSpacingAfter,   setSpacingBefore,   setTemplateData,   setTransparency,   setUrl,   setWidthPercentage,   setXYRatio,   simplifyColorspace,   tagICC,   type
Methods from com.lowagie.text.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,   isNestable,   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,   type
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from com.lowagie.text.Image Detail:
 public float getAbsoluteX() 
    Returns the absolute X position.
 public float getAbsoluteY() 
    Returns the absolute Y position.
 public PdfDictionary getAdditional() 
    Getter for the dictionary with additional information.
 public int getAlignment() 
    Gets the alignment for the image.
 public String getAlt() 
    Gets the alternative text for the image.
 public Annotation getAnnotation() 
    Gets the annotation.
 public int getBpc() 
    Gets the bpc for the image.

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

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

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

 public int getCompressionLevel() 
    Returns the compression level used for images written as a compressed stream.
 public PdfIndirectReference getDirectReference() 
    Getter for property directReference.
 public int getDpiX() 
    Gets the dots-per-inch in the X direction. Returns 0 if not available.
 public int getDpiY() 
    Gets the dots-per-inch in the Y direction. Returns 0 if not available.
 public ICC_Profile getICCProfile() 
    Gets the images ICC profile.
 public Image getImageMask() 
    Gets the explicit masking.
 public float getImageRotation() 
    Gets the current image rotation in radians.
 public float getIndentationLeft() 
    Gets the left indentation.
 public float getIndentationRight() 
    Gets the right indentation.
 public float getInitialRotation() 
    Getter for property initialRotation.
 public static Image getInstance(URL url) throws BadElementException, MalformedURLException, IOException 
    Gets an instance of an Image.
 public static Image getInstance(String filename) throws BadElementException, MalformedURLException, IOException 
    Gets an instance of an Image.
 public static Image getInstance(byte[] imgb) throws BadElementException, MalformedURLException, IOException 
    gets an instance of an Image
 public static Image getInstance(PdfTemplate template) throws BadElementException 
    gets an instance of an Image
 public static Image getInstance(PRIndirectReference ref) throws BadElementException 
    Reuses an existing image.
 public static Image getInstance(Image image) 
    gets an instance of an Image
 public static Image getInstance(Image image,
    Color color) throws BadElementException, IOException 
    Gets an instance of an Image from a java.awt.Image.
 public static Image getInstance(Image image,
    Color color,
    boolean forceBW) throws BadElementException, IOException 
    Gets an instance of an Image from a java.awt.Image.
 public static Image getInstance(PdfWriter writer,
    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 user defined quality.
 public static Image getInstance(PdfContentByte cb,
    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 user defined quality.
 public static Image getInstance(int width,
    int height,
    byte[] data,
    byte[] globals) 
    Creates a JBIG2 Image.
 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.
 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.
 public 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.
 public 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.
 public PdfOCG getLayer() 
    Gets the layer this image belongs to.
 public Long getMySerialId() 
    Returns a serial id for the Image (reuse the same image more than once)
 public byte[] getOriginalData() 
    Getter for property originalData.
 public int getOriginalType() 
    Getter for property originalType.
 public float getPlainHeight() 
    Gets the plain height of the image.
 public float getPlainWidth() 
    Gets the plain width of the image.
 public byte[] getRawData() 
    Gets the raw data for the image.

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

 public float getScaledHeight() 
    Gets the scaled height of the image.
 public float getScaledWidth() 
    Gets the scaled width of the image.
 protected static synchronized Long getSerialId() 
    Creates a new serial id.
 public float getSpacingAfter() 
    Gets the spacing before this image.
 public float getSpacingBefore() 
    Gets the spacing before this image.
 public PdfTemplate getTemplateData() 
    Gets the template to be used as an image.

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

 public int[] getTransparency() 
    Returns the transparency.
 public URL getUrl() 
    Gets the String -representation of the reference to the image.
 public float getWidthPercentage() 
    Getter for property widthPercentage.
 public float getXYRatio() 
    Gets the X/Y pixel dimensionless aspect ratio.
 public boolean hasAbsoluteX() 
    Checks if the Images has to be added at an absolute X position.
 public boolean hasAbsoluteY() 
    Checks if the Images has to be added at an absolute position.
 public boolean hasICCProfile() 
    Checks is the image has an ICC profile.
 public boolean isDeflated() 
    Getter for property deflated.
 public boolean isImgRaw() 
    Returns true if the image is a ImgRaw -object.
 public boolean isImgTemplate() 
    Returns true if the image is an ImgTemplate -object.
 public boolean isInterpolation() 
    Getter for property interpolation.
 public boolean isInverted() 
    Getter for the inverted value
 public boolean isJpeg() 
    Returns true if the image is a Jpeg -object.
 public boolean isMask() 
    Returns true if this Image is a mask.
 public boolean isMaskCandidate() 
    Returns true if this Image has the requisites to be a mask.
 public boolean isNestable() 
 public boolean isSmask() 
    Getter for property smask.
 public  void makeMask() throws DocumentException 
    Make this Image a mask.
 public float[] matrix() 
    Returns the transformation matrix of the image.
 public  void scaleAbsolute(float newWidth,
    float newHeight) 
    Scale the image to an absolute width and an absolute height.
 public  void scaleAbsoluteHeight(float newHeight) 
    Scale the image to an absolute height.
 public  void scaleAbsoluteWidth(float newWidth) 
    Scale the image to an absolute width.
 public  void scalePercent(float percent) 
    Scale the image to a certain percentage.
 public  void scalePercent(float percentX,
    float percentY) 
    Scale the width and height of an image to a certain percentage.
 public  void scaleToFit(float fitWidth,
    float fitHeight) 
    Scales the image so that it fits a certain width and height.
 public  void setAbsolutePosition(float absoluteX,
    float absoluteY) 
    Sets the absolute position of the Image.
 public  void setAdditional(PdfDictionary additional) 
    Sets the /Colorspace key.
 public  void setAlignment(int alignment) 
    Sets the alignment for the image.
 public  void setAlt(String alt) 
    Sets the alternative information for the image.
 public  void setAnnotation(Annotation annotation) 
    Sets the annotation of this Image.
 public  void setCompressionLevel(int compressionLevel) 
    Sets the compression level to be used if the image is written as a compressed stream.
 public  void setDeflated(boolean deflated) 
    Setter for property deflated.
 public  void setDirectReference(PdfIndirectReference directReference) 
    Setter for property directReference.
 public  void setDpi(int dpiX,
    int dpiY) 
    Sets the dots per inch value
 public  void setImageMask(Image mask) throws DocumentException 
    Sets the explicit masking.
 public  void setIndentationLeft(float f) 
    Sets the left indentation.
 public  void setIndentationRight(float f) 
    Sets the right indentation.
 public  void setInitialRotation(float initialRotation) 
    Some image formats, like TIFF may present the images rotated that have to be compensated.
 public  void setInterpolation(boolean interpolation) 
    Sets the image interpolation. Image interpolation attempts to produce a smooth transition between adjacent sample values.
 public  void setInverted(boolean invert) 
    Sets inverted true or false
 public  void setLayer(PdfOCG layer) 
    Sets the layer this image belongs to.
 public  void setOriginalData(byte[] originalData) 
    Setter for property originalData.
 public  void setOriginalType(int originalType) 
    Setter for property originalType.
 public  void setRotation(float r) 
    Sets the rotation of the image in radians.
 public  void setRotationDegrees(float deg) 
    Sets the rotation of the image in degrees.
 public  void setSmask(boolean smask) 
    Setter for property smask.
 public  void setSpacingAfter(float spacing) 
    Sets the spacing after this image.
 public  void setSpacingBefore(float spacing) 
    Sets the spacing before this image.
 public  void setTemplateData(PdfTemplate template) 
    Sets data from a PdfTemplate
 public  void setTransparency(int[] transparency) 
    Sets the transparency values
 public  void setUrl(URL url) 
    Sets the url of the image
 public  void setWidthPercentage(float widthPercentage) 
    Setter for property widthPercentage.
 public  void setXYRatio(float XYRatio) 
    Sets the X/Y pixel dimensionless aspect ratio.
 public  void simplifyColorspace() 
    Replaces CalRGB and CalGray colorspaces with DeviceRGB and DeviceGray.
 public  void tagICC(ICC_Profile profile) 
    Tags this image with an ICC profile.
 public int type() 
    Returns the type.