org.faceless.pdf2
Class PDFImageSet

java.lang.Object
  extended by org.faceless.pdf2.PDFImageSet

public final class PDFImageSet
extends Object

The PDFImageSet class is a thin wrapper around a multi-page image format (currently only TIFF images). Although it can be used with single page images, it's simpler just to create a PDFImage directly.

Example
   PDFImageSet tiff = new PDFImageSet(new FileInputStream("multipage.tif"));
   PDFImage page1 = tiff.getImage(1);
   PDFImage page2 = tiff.getImage(2);
 

Since:
1.1.13
See Also:
PDFImage

Constructor Summary
PDFImageSet(InputStream in)
          Create a new PDFImageSet from the specified InputStream.
 
Method Summary
 void close()
          Close all of the images in this Image set.
 PDFImage getImage(int page)
          Return the specified sub-image from this image as a PDFImage.
 int getNumImages()
          Return the number of sub images, or "pages" in this image set.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PDFImageSet

public PDFImageSet(InputStream in)
            throws IOException
Create a new PDFImageSet from the specified InputStream. The stream must contain a recognized Image format - see the PDFImage class for a list of formats and restrictions. The InputStream is left open, and for streams containing multiple images (i.e. TIFF), it should be left open until all the required images from the file are loaded.

Throws:
IOException - if the image cannot be loaded or the format cannot be parsed
IllegalArgumentException - if the image cannot be parsed
Method Detail

getNumImages

public int getNumImages()
Return the number of sub images, or "pages" in this image set. For all formats but TIFF this will return 1.

Returns:
the number of pages in this image

getImage

public PDFImage getImage(int page)
                  throws IOException
Return the specified sub-image from this image as a PDFImage. If the requested page is out of range this method throws an ArrayIndexOutOfBoundsException. If the specified subimage is corrupt or cannot be parsed, throws an IOException

Parameters:
page - the page number, from 0 to getNumImages()
Throws:
IOException - if the TIFF file is corrupt or the image cannot be used
ArrayIndexOutOfBoundsException

close

public void close()
Close all of the images in this Image set. Simply calls the PDFImage.close() method for all of the images.

Since:
2.2.3


Copyright © 2001-2010 Big Faceless Organization