Package net.atthegate.server.service.pdf
Class Image
java.lang.Object
net.atthegate.server.service.pdf.Image
- All Implemented Interfaces:
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.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloat[]
Draws this image on the specified page.void
flipUpsideDown
(boolean flipUpsideDown) float
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
Places this image in the specified box.void
resizeToFit
(Page page, boolean keepAspectRatio) scaleBy
(double factor) Scales this image by the specified factor.scaleBy
(float factor) Scales this image by the specified factor.scaleBy
(float widthFactor, float heightFactor) Scales this image by the specified width and height factor.setActualText
(String actualText) Sets the actual text for this image.setAltDescription
(String altDescription) Sets the alternate description of this image.void
setGoToAction
(String key) Sets the destination key for the action.setLocation
(float x, float y) Sets the location of this image on the page to (x, y).setPosition
(double x, double y) Sets the position of this image on the page to (x, y).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
(String uri) Sets the URI for the "click box" action.
-
Field Details
-
objNumber
protected int objNumber -
x
protected float x -
y
protected float y -
w
protected float w -
h
protected float h -
uri
-
key
-
-
Constructor Details
-
Image
The main constructor for the Image class.- Parameters:
pdf
- the PDF to which we add this image.inputStream
- the input stream to read the image from.imageType
- ImageType.JPG, ImageType.PNG and ImageType.BMP.- Throws:
Exception
-
Image
- Throws:
Exception
-
Image
Constructor used to attach images to existing PDF.- Parameters:
objects
- the map to which we add this image.inputStream
- the input stream to read the image from.imageType
- ImageType.JPG, ImageType.PNG and ImageType.BMP.- Throws:
Exception
-
-
Method Details
-
setPosition
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
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
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
Scales this image by the specified factor.- Parameters:
factor
- the factor used to scale the image.
-
scaleBy
Scales this image by the specified factor.- Parameters:
factor
- the factor used to scale the image.
-
scaleBy
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 imageheightFactor
- the factor used to scale the height of the image
-
placeIn
Places this image in the specified box.- Parameters:
box
- the specified box.- Throws:
Exception
-
setURIAction
Sets the URI for the "click box" action.- Parameters:
uri
- the URI
-
setGoToAction
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
Sets the alternate description of this image.- Parameters:
altDescription
- the alternate description of the image.- Returns:
- this Image.
-
setActualText
Sets the actual text for this image.- Parameters:
actualText
- the actual text for the image.- Returns:
- this Image.
-
drawOn
Draws this image on the specified page. -
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.
-
resizeToFit
-
flipUpsideDown
public void flipUpsideDown(boolean flipUpsideDown)
-