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.
PDFImageSet tiff = new PDFImageSet(new FileInputStream("multipage.tif")); PDFImage page1 = tiff.getImage(1); PDFImage page2 = tiff.getImage(2);
PDFImage
Constructor and Description |
---|
PDFImageSet(InputStream in)
Create a new
PDFImageSet from the specified InputStream. |
Modifier and Type | Method and Description |
---|---|
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.
|
public PDFImageSet(InputStream in) throws IOException
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.IOException
- if the image cannot be loaded or the format cannot be parsedIllegalArgumentException
- if the image cannot be parsedpublic int getNumImages()
public PDFImage getImage(int page) throws IOException
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
page
- the page number, from 0 to getNumImages()
IOException
- if the TIFF file is corrupt or the image cannot be usedArrayIndexOutOfBoundsException
public void close()
PDFImage.close()
method for all of the images.Copyright © 2001-2017 Big Faceless Organization