Gnostice PDFOne
Pro. Ed. v1.41


com.gnostice.pdfone
Class PdfImage

java.lang.Object
  extended bycom.gnostice.pdfone.PdfObject
      extended bycom.gnostice.pdfone.PdfStream
          extended bycom.gnostice.pdfone.PdfImage
All Implemented Interfaces:
Cloneable

public abstract class PdfImage
extends PdfStream

This class represents an image that can be used in a document or page. PdfImage currently supports Joint Photographic Experts Group (JPEG), bitmap (BMP), and Portable Network Graphics (PNG) image formats.

Methods of this class can:

  1. create an instance based on an image file
  2. retrieve original height and width of an image
  3. retrieve height and width currently set for the object
  4. specify height and width for the object
  5. retrieve number of bits used to store value of each component in colorspace for this image

After creating an object of this class, you can use methods such as drawImage of PdfPage or PdfDocument instances to add images. The object's height and width will be interpreted in terms of current measurement unit of the page or document. See example.

Since:
1.0
Version:
1.0

Method Summary
 int bitsPerComponent()
          Returns number of bits used to store value of each component of colorspace for this image.
static PdfImage create(FileImageInputStream imageStream)
           
static PdfImage create(String path)
          Creates a PdfImage object based on image file specified by path.
 PdfObject getColorSpace()
           
 float getHeight()
          Retrieves height currently set for this object.
 float getRotation()
          Retrieves rotation angle currently set for this object.
 float getWidth()
          Retrieves width currently set for this object.
 int hashCode()
           
 float height()
          Retrieves original height of image.
 void setHeight(double height)
          Specifies height for this object.
 void setRotation(double r)
          Specifies rotation angle for this object.
 void setWidth(double width)
          Specifies width for this object.
 float width()
          Retrieves original width of image.
 
Methods inherited from class com.gnostice.pdfone.PdfStream
clone, equals, getBuffer, getDecodeParms, getDictionary, getFilters, setBuffer
 
Methods inherited from class com.gnostice.pdfone.PdfObject
getGenerationNumber, getObjectNumber, setGenerationNumber, setObjectNumber, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

create

public static PdfImage create(String path)
                       throws IOException,
                              PdfException
Creates a PdfImage object based on image file specified by path.

Parameters:
path - relative or fully qualified path and filename of the image
Returns:
a new PdfImage object
Throws:
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.
Since:
1.0
Sample Code
See example.

create

public static PdfImage create(FileImageInputStream imageStream)
                       throws IOException,
                              PdfException
Throws:
IOException
PdfException

setWidth

public void setWidth(double width)
Specifies width for this object.

Parameters:
width - width in current measurement unit
Since:
1.0
Sample Code
See example.

getWidth

public float getWidth()
Retrieves width currently set for this object.

Returns:
width in current measurement unit
Since:
1.0
Sample Code
See example.

setHeight

public void setHeight(double height)
Specifies height for this object.

Parameters:
height - height in current measurement unit
Since:
1.0
Sample Code
See example.

getHeight

public float getHeight()
Retrieves height currently set for this object.

Returns:
height in current measurement unit
Since:
1.0
Sample Code
See example.

setRotation

public void setRotation(double r)
Specifies rotation angle for this object. The default rotation angle for any object is 0.0 degrees.

Parameters:
r - angle of rotation in degrees (Made with reference to center of image. Applied in anti-clockwise direction.)
Since:
1.0
Sample Code
See example.

getRotation

public float getRotation()
Retrieves rotation angle currently set for this object.

Returns:
angle of rotation in degrees (Made with reference to center of image. Applied in anti-clockwise direction.)
Since:
1.0
Sample Code
See example.

bitsPerComponent

public int bitsPerComponent()
Returns number of bits used to store value of each component of colorspace for this image.

Returns:
number of bits used to store each component of colorspace
Since:
1.0
Sample Code
See example.

getColorSpace

public PdfObject getColorSpace()

width

public float width()
Retrieves original width of image. Original width is as in the image file.

Returns:
width of image in pixels
Since:
1.0
Sample Code
See example.

height

public float height()
Retrieves original height of image. Original height is as in the image file.

Returns:
height of image in pixels
Since:
1.0
Sample Code
See example.

hashCode

public int hashCode()

Gnostice PDFOne
Pro. Ed. v1.41

To contact our support team, send an e-mail to support@gnostice.com.
 
© 2006 Gnostice Information Technologies Private Limited. All rights reserved.
www.gnostice.com