com.pdfjet
Class Image

java.lang.Object
  extended by com.pdfjet.Image
All Implemented Interfaces:
Drawable

public class Image
extends java.lang.Object
implements Drawable

Used to create image objects and draw them on a page. The image type can be one of the following: ImageType.JPG, ImageType.PNG, ImageType.BMP or ImageType.JET Please see Example_03 and Example_24.


Constructor Summary
Image(PDF pdf, java.io.InputStream inputStream, int imageType)
          The main constructor for the Image class.
 
Method Summary
 float[] drawOn(Page page)
          Draws this image on the specified page.
 float getHeight()
          Returns the height of this image when drawn on the page.
 float getWidth()
          Returns the width of this image when drawn on the page.
 void placeIn(Box box)
          Places this image in the specified box.
 void scaleBy(double factor)
          Scales this image by the specified factor.
 void scaleBy(float factor)
          Scales this image by the specified factor.
 void scaleBy(float widthFactor, float heightFactor)
          Scales this image by the specified width and height factor.
 Image setActualText(java.lang.String actualText)
          Sets the actual text for this image.
 Image setAltDescription(java.lang.String altDescription)
          Sets the alternate description of this image.
 void setGoToAction(java.lang.String key)
          Sets the destination key for the action.
 void setLocation(float x, float y)
          Sets the location of this image on the page to (x, y).
 void setPosition(double x, double y)
          Sets the position of this image on the page to (x, y).
 void setPosition(float x, float y)
          Sets the position of this image on the page to (x, y).
 void setRotate(int degrees)
          Sets the image rotation to the specified number of degrees.
 void setRotateCW90(boolean rotate90)
          Sets the rotate90 flag.
 void setURIAction(java.lang.String uri)
          Sets the URI for the "click box" action.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Image

public Image(PDF pdf,
             java.io.InputStream inputStream,
             int imageType)
      throws java.lang.Exception
The main constructor for the Image class.

Parameters:
pdf - the page to draw this image on.
inputStream - the input stream to read the image from.
imageType - ImageType.JPG, ImageType.PNG and ImageType.BMP.
Throws:
java.lang.Exception
Method Detail

setPosition

public void setPosition(double x,
                        double y)
Sets the position of this image on the page to (x, y).

Parameters:
x - the x coordinate of the top left corner of the image.
y - the y coordinate of the top left corner of the image.

setPosition

public void setPosition(float x,
                        float y)
Sets the position of this image on the page to (x, y).

Parameters:
x - the x coordinate of the top left corner of the image.
y - the y coordinate of the top left corner of the image.

setLocation

public void setLocation(float x,
                        float y)
Sets the location of this image on the page to (x, y).

Parameters:
x - the x coordinate of the top left corner of the image.
y - the y coordinate of the top left corner of the image.

scaleBy

public void scaleBy(double factor)
Scales this image by the specified factor.

Parameters:
factor - the factor used to scale the image.

scaleBy

public void scaleBy(float factor)
Scales this image by the specified factor.

Parameters:
factor - the factor used to scale the image.

scaleBy

public void scaleBy(float widthFactor,
                    float heightFactor)
Scales this image by the specified width and height factor.

Author: Pieter Libin, pieter@emweb.be

Parameters:
widthFactor - the factor used to scale the width of the image
heightFactor - the factor used to scale the height of the image

placeIn

public void placeIn(Box box)
             throws java.lang.Exception
Places this image in the specified box.

Parameters:
box - the specified box.
Throws:
java.lang.Exception

setURIAction

public void setURIAction(java.lang.String uri)
Sets the URI for the "click box" action.

Parameters:
uri - the URI

setGoToAction

public void setGoToAction(java.lang.String key)
Sets the destination key for the action.

Parameters:
key - the destination name.

setRotateCW90

public void setRotateCW90(boolean rotate90)
Sets the rotate90 flag. When the flag is true the image is rotated 90 degrees clockwise.

Parameters:
rotate90 - the flag.

setRotate

public void setRotate(int degrees)
Sets the image rotation to the specified number of degrees.

Parameters:
degrees - the number of degrees.

setAltDescription

public Image setAltDescription(java.lang.String altDescription)
Sets the alternate description of this image.

Parameters:
altDescription - the alternate description of the image.
Returns:
this Image.

setActualText

public Image setActualText(java.lang.String actualText)
Sets the actual text for this image.

Parameters:
actualText - the actual text for the image.
Returns:
this Image.

drawOn

public float[] drawOn(Page page)
               throws java.lang.Exception
Draws this image on the specified page.

Specified by:
drawOn in interface Drawable
Parameters:
page - the page to draw this image on.
Returns:
x and y coordinates of the bottom right corner of this component.
Throws:
java.lang.Exception

getWidth

public float getWidth()
Returns the width of this image when drawn on the page. The scaling is take into account.

Returns:
w - the width of this image.

getHeight

public float getHeight()
Returns the height of this image when drawn on the page. The scaling is take into account.

Returns:
h - the height of this image.