com.crionics.jpdf.graphic
Class PdfGraphic

java.lang.Object
  extended by com.crionics.jpdf.graphic.PdfGraphic

public class PdfGraphic
extends java.lang.Object

java representation of a Pdf graphic element.


Constructor Summary
PdfGraphic(java.lang.String name, PdfImage imageObject)
          Creates a new Graphic object.
 
Method Summary
 void addAlternateImage(AbstractImage image, boolean useForPrinting)
          Allows the creation of an alternate image for an existing one.
 int getHeight()
          Returns the height of the graphic in pixels.
 AbstractImage getImage()
          Returns the Image Object of the current graphical object.
 java.lang.String getName()
          Returns the Name referencing the current graphic in the PDF Document.
 int getWidth()
          Returns the width of the graphic in pixels.
 boolean isColor()
          Returns true if the graphic contains colors
 void setColor(boolean color)
          Sets the color.
 void setImage(AbstractImage image)
          Updates the current image with the supplied Images Object.
 void setImage(java.io.File imageFile)
          Updates the current image, with the supplied Image File.
 void setImage(java.awt.Image image)
          Updates the current image with the supplied AWT Image.
 void setImage(java.lang.String imageFilename)
          Updates the current image with the supplied Image Filename.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PdfGraphic

public PdfGraphic(java.lang.String name,
                  PdfImage imageObject)
Creates a new Graphic object.

Parameters:
name - The name referencing the image in the Document.
imageObject - The Image Object
Method Detail

addAlternateImage

public void addAlternateImage(AbstractImage image,
                              boolean useForPrinting)
                       throws java.io.IOException,
                              PdfException
Allows the creation of an alternate image for an existing one. This mostly used to differenciate the image to be seen on a PDF viewer, and the one which will be printed (for example, the first one could be in low resolution, while the second one in high resolution).

Parameters:
image - The alternate image (@link ImageConvertor);
useForPrinting - true if the specified alternate image is to be used when the PDF is printed.
Throws:
java.io.IOException - Raised if a problem occured while reading the file.
PdfException - Raised if a problem occured while parsing the file.

getHeight

public int getHeight()
              throws java.io.IOException,
                     PdfException
Returns the height of the graphic in pixels.

Returns:
The graphic height.
Throws:
java.io.IOException - Raised if a problem occured while reading the file.
PdfException - Raised if a problem occured while parsing the file.

getImage

public AbstractImage getImage()
                       throws java.io.IOException,
                              PdfException
Returns the Image Object of the current graphical object.

Returns:
The Image Object of the current graphical obbject.
Throws:
java.io.IOException - Raised if a problem occured while reading the file.
PdfException - Raised if a problem occured while parsing the file.

getName

public java.lang.String getName()
Returns the Name referencing the current graphic in the PDF Document.

Returns:
The referencing name of the graphic.

getWidth

public int getWidth()
             throws java.io.IOException,
                    PdfException
Returns the width of the graphic in pixels.

Returns:
The graphic width.
Throws:
java.io.IOException - Raised if a problem occured while reading the file.
PdfException - Raised if a problem occured while parsing the file.

isColor

public boolean isColor()
Returns true if the graphic contains colors

Returns:
boolean true if the graphic contains colors

setColor

public void setColor(boolean color)
Sets the color.

Parameters:
color - The color to set

setImage

public void setImage(AbstractImage image)
              throws java.io.IOException,
                     PdfException
Updates the current image with the supplied Images Object.

Parameters:
image - The Images Object to write in the PDF document.
Throws:
java.io.IOException - Raised if a problem occured while reading the file.
PdfException - Raised if a problem occured while parsing the file.

setImage

public void setImage(java.io.File imageFile)
              throws java.io.IOException,
                     PdfException
Updates the current image, with the supplied Image File.
Note: if you want to do any operation on the image (Flipping,resizing,...) load the image first via ImageConvertor.loadImage(File), do the required operations and then use the method setImage(AbstractImage)

Parameters:
imageFile - The Image File to write in the PDF document. (Can be a JPEG or any other image recognized by the AWT API).
Throws:
java.io.IOException - Raised if a problem occured while reading the file.
PdfException - Raised if a problem occured while parsing the file.

setImage

public void setImage(java.awt.Image image)
              throws java.io.IOException,
                     PdfException
Updates the current image with the supplied AWT Image.
Note: if you want to do any operation on the image Flipping,resizing,...) load the image first via ImageConvertor.loadImage(Image), do the required operations and then use the method setImage(AbstractImage)

Parameters:
image - The AWT Image to write in the PDF document.
Throws:
java.io.IOException - Raised if a problem occured while reading the file.
PdfException - Raised if a problem occured while parsing the file.

setImage

public void setImage(java.lang.String imageFilename)
              throws java.io.IOException,
                     PdfException
Updates the current image with the supplied Image Filename.
Note: if you want to do any operation on the image Flipping,resizing,...) load the image first via ImageConvertor.loadImage(String), do the required operations and then use the method setImage(AbstractImage)

Parameters:
imageFilename - The filename of the Image to write in the PDF document. (Can be a JPEG or any other image recognized by the AWT API).
Throws:
java.io.IOException - Raised if a problem occured while reading the file.
PdfException - Raised if a problem occured while parsing the file.


Copyright © 1999-2007 Crionics. All Rights Reserved.