public class PDFImages extends Object
PDFImages class provides methods to load PDF documents and export or import
 images from and to the document.  The object can export pages or sections of pages as images and
 can also create new pages from images.  Documents can be loaded from the file system,
 from a URL or from a Java InputStream, or can be created from scratch.| Modifier and Type | Class and Description | 
|---|---|
| static class  | PDFImages.KeyInfoImages
 This is the Main-Class for the jPDFImages.jar that can generate server
 key requests, validate a key, and display server information. | 
| Constructor and Description | 
|---|
| PDFImages()Creates a blank PDFImages object. | 
| PDFImages(InputStream inStream,
         IPassword password)Loads a PDF document from an InputStream. | 
| PDFImages(PDFSource source,
         IPassword password)Loads a PDF document from a PDFSource object. | 
| PDFImages(String fileName,
         IPassword password)Loads a PDF document from a file. | 
| PDFImages(URL url,
         IPassword password)Loads a PDF document from a URL. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | appendGIFAsPage(InputStream inStream,
               int dpi)Creates a new page in the PDF document and adds the GIF image to it. | 
| void | appendGIFAsPage(String gifFileName,
               int dpi)Creates a new page in the PDF document and adds the GIF image to it. | 
| void | appendJPEGAsPage(InputStream inStream)Creates a new page in the PDF document and adds the JPEG image to it. | 
| void | appendJPEGAsPage(String jpegFileName)Creates a new page in the PDF document and adds the JPEG file to it. | 
| void | appendJPEGAsPage(String jpegFileName,
                int dpi)Creates a new page in the PDF document and adds the JPEG file to it. | 
| void | appendPNGAsPage(InputStream inStream)Creates a new page in the PDF document adds the PNG content to it. | 
| void | appendPNGAsPage(String pngFileName)Creates a new page in the PDF document and adds the PNG file to it. | 
| void | appendTIFFAsPages(InputStream inStream)Appends the pages in a TIFF image from an input stream to the end of this document. | 
| void | appendTIFFAsPages(String tiffFileName)Appends the pages in a TIFF file to the end of this document. | 
| void | close()Close / release all resources held by this document. | 
| Rectangle2D | getCropBox(int pageIndex)Returns the PDF page's 'CropBox'. | 
| double | getDisplayHeight(int pageIndex)Returns the display height of this page in 72 DPI. | 
| double | getDisplayWidth(int pageIndex)Returns the display width of this page in 72 DPI. | 
| DocumentInfo | getDocumentInfo()Returns a DocumentInfo object containing the information
 section of a PDF document (author, title, etc.) | 
| Rectangle2D | getMediaBox(int pageIndex)Returns the PDF page's 'MediaBox'. | 
| int | getPageCount()Returns the number of pages in this document. | 
| BufferedImage | getPageImage(int pageIndex,
            int resDPI)Returns an RGB BufferedImage containing a rendering
 of the page at the given resolution in DPI. | 
| BufferedImage | getPageImage(int pageIndex,
            int width,
            int height)Returns an RGB BufferedImage containing a rendering of the page at the given page size. | 
| BufferedImage | getPageImageCS(int pageIndex,
              int dpi,
              ColorSpace imageCS)Returns a BufferedImage, created in the given color space, containing a rendering of the page at the given resolution in DPI. | 
| BufferedImage | getPageImageCS(int pageIndex,
              int dpi,
              ColorSpace imageCS,
              boolean simOverprint)Returns a BufferedImage, created in the given color space, containing a rendering of the page at the given resolution in DPI. | 
| int | getPageRotation(int pageIndex)Returns a page's rotation value, in degrees. | 
| BufferedImage | getPageSubImage(int pageIndex,
               Rectangle2D pageArea,
               int dpi)Returns a BufferedImage containing a rendering of part of the page at a given scale. | 
| double | getPaperHeight(int pageIndex)Returns the paper's height of this page in 72 DPI. | 
| double | getPaperWidth(int pageIndex)Returns the paper's width of this page in 72 DPI. | 
| static String | getVersion()Returns version string for jPDFImages. | 
| IWatermark | getWatermark()Returns the watermark for the PDFImages document. | 
| void | saveDocument(OutputStream outStream)Saves this document to an output stream. | 
| void | saveDocument(String fileName)Saves this document to a file. | 
| void | saveDocumentAsTIFF(OutputStream outStream,
                  TIFFOptions options)Save the entire document as a multi-page TIFF image to an OutputStream. | 
| void | saveDocumentAsTIFF(String fileName,
                  double resDPI,
                  String tiffCompression)Save the entire document as a multi-page TIFF image to the given file. | 
| void | saveDocumentAsTIFF(String fileName,
                  TIFFOptions options)Save the entire document as a multi-page TIFF image to the given file. | 
| void | savePageAsJPEG(int pageIndex,
              OutputStream outStream,
              int resDPI,
              float quality)Save the rendered image of the page to the given OutputStream in JPEG format. | 
| void | savePageAsJPEG(int pageIndex,
              String fileName,
              int resDPI,
              float quality)Save the rendered image of the page to the given file in JPEG format. | 
| void | savePageAsPNG(int pageIndex,
             OutputStream outStream,
             int dpi)Save the rendered image of the page to the given OutputStream in PNG format. | 
| void | savePageAsPNG(int pageIndex,
             String fileName,
             int dpi)Save the rendered image of the page to the given OutputStream in PNG format. | 
| void | savePageAsTIFF(int pageIndex,
              OutputStream outStream,
              TIFFOptions options)Render a page to an image and save it in TIFF format. | 
| void | savePageAsTIFF(int pageIndex,
              String fileName,
              TIFFOptions options)Render a page to an image and save it in TIFF format. | 
| static boolean | setAppletKey(String key,
            Applet applet)Method to unlock the production version of the library. | 
| static boolean | setKey(String key)Method to unlock the production version of the library. | 
| void | setWatermark(IWatermark watermark)Sets the watermark on the PDFImages document. | 
| boolean | usePermissionsPassword(String ownerPassword)Tells the PDFImages object that the permissions password is known, so all
 permissions are granted. | 
public PDFImages()
          throws PDFException
PDFExceptionpublic PDFImages(String fileName, IPassword password) throws PDFException
fileName - Name of the PDF file.password - An object that provides passwords to open the document, leave null if not needed.
 When working with documents that have no passwords, the host application should pass null for the
 value of this parameter.  When documents are known to have passwords, the host application should 
 pass an instance of the PDFPassword class that can hold a single
 password or a list of passwords.PDFExceptionpublic PDFImages(InputStream inStream, IPassword password) throws PDFException
inStream - InputStream to read the PDF document.password - An object that provides passwords to open the document, leave null if not needed.
 When working with documents that have no passwords, the host application should pass null for the
 value of this parameter.  When documents are known to have passwords, the host application should 
 pass an instance of the PDFPassword class that can hold a single
 password or a list of passwords.PDFExceptionpublic PDFImages(URL url, IPassword password) throws PDFException
url - Location of the PDF document.password - An object that provides passwords to open the document, leave null if not needed.
 When working with documents that have no passwords, the host application should pass null for the
 value of this parameter.  When documents are known to have passwords, the host application should 
 pass an instance of the PDFPassword class that can hold a single
 password or a list of passwords.PDFExceptionpublic PDFImages(PDFSource source, IPassword password) throws PDFException
source - Source of the PDF document.password - An object that provides passwords to open the document, leave null if not needed.
 When working with documents that have no passwords, the host application should pass null for the
 value of this parameter.  When documents are known to have passwords, the host application should 
 pass an instance of the PDFPassword class that can hold a single
 password or a list of passwords.PDFExceptionpublic void close()
public DocumentInfo getDocumentInfo()
public static boolean setKey(String key)
key - Production key.public static boolean setAppletKey(String key, Applet applet)
key - Production key.public static String getVersion()
public BufferedImage getPageImage(int pageIndex, int resDPI) throws PDFException
pageIndex - The 0 based page index.resDPI - Dots per inch at which to render the image.  72 is the PDF native DPI and 100% scalePDFExceptionpublic BufferedImage getPageImageCS(int pageIndex, int dpi, ColorSpace imageCS) throws PDFException
dpi - Dots per inch at which to render the image.imageCS - The color space to use when creating the image.PDFExceptionpublic BufferedImage getPageImageCS(int pageIndex, int dpi, ColorSpace imageCS, boolean simOverprint) throws PDFException
dpi - Dots per inch at which to render the image.imageCS - The color space to use when creating the image.simOverprint - Boolean flag indicating whether the rendering should simulate overprintPDFExceptionpublic BufferedImage getPageImage(int pageIndex, int width, int height) throws PDFException
pageIndex - The 0 based page index.width - The width of the desired image, in pixelsheight - The height of the desired image, in pixelsPDFExceptionpublic BufferedImage getPageSubImage(int pageIndex, Rectangle2D pageArea, int dpi) throws PDFException
pageIndex - The 0 based page index.pageArea - Rectangle of the area from which the image should be created.  This rectangle should be
 in the page coordinate system, which is at 72 DPI.dpi - Dots per inch at which to render the image.  72 is the PDF native DPI and 100% scale.PDFExceptionpublic double getPaperHeight(int pageIndex)
pageIndex - The 0 based page index.public double getPaperWidth(int pageIndex)
pageIndex - The 0 based page index.public Rectangle2D getMediaBox(int pageIndex)
public Rectangle2D getCropBox(int pageIndex)
public double getDisplayHeight(int pageIndex)
public double getDisplayWidth(int pageIndex)
pageIndex - The 0 based page index.public int getPageCount()
public int getPageRotation(int pageIndex)
pageIndex - The 0 based page index.public void savePageAsPNG(int pageIndex,
                 OutputStream outStream,
                 int dpi)
                   throws IOException,
                          PDFException
pageIndex - The 0 based page index.outStream - The stream to save the image to.dpi - Dots per inch at which to render the image.  72 is the native PDF resolution and is equivalent to 100% scale.IOExceptionPDFExceptionpublic void savePageAsPNG(int pageIndex,
                 String fileName,
                 int dpi)
                   throws IOException,
                          PDFException
pageIndex - The 0 based page index.fileName - The name of the PNG file.dpi - Dots per inch at which to render the image.  72 is the native PDF resolution and is equivalent to 100% scale.IOExceptionPDFExceptionpublic void savePageAsJPEG(int pageIndex,
                  OutputStream outStream,
                  int resDPI,
                  float quality)
                    throws IOException,
                           PDFException
pageIndex - The 0 based page index.outStream - The stream to save the image to.resDPI - Dots per inch at which to render the image.  72 is the native PDF resolution and is equivalent to 100% scale.quality - The quality setting to use for JPEG compression.  The range for this value is 0.0 to 1.0.
 Lower values mean higher compression and lower quality.  As a guideline, 0.25 is low quality, 0.5 is medium
 quality and 0.75 is high quality.IOExceptionPDFExceptionpublic void savePageAsJPEG(int pageIndex,
                  String fileName,
                  int resDPI,
                  float quality)
                    throws IOException,
                           PDFException
pageIndex - The 0 based page index.fileName - The name of the file to save to.resDPI - Dots per inch at which to render the image.  72 is the native PDF resolution and is equivalent to 100% scale.quality - The quality setting to use for JPEG compression.  The range for this value is 0.0 to 1.0.
 Lower values mean higher compression and lower quality.  As a guideline, 0.25 is low quality, 0.5 is medium
 quality and 0.75 is high quality.IOExceptionPDFExceptionpublic void savePageAsTIFF(int pageIndex,
                  String fileName,
                  TIFFOptions options)
                    throws IOException,
                           PDFException
pageIndex - The 0 based page index.fileName - The name of the file to save the image to.options - Options to use when saving the image, such as the TIFF compression type.IOExceptionPDFExceptionpublic void savePageAsTIFF(int pageIndex,
                  OutputStream outStream,
                  TIFFOptions options)
                    throws IOException,
                           PDFException
pageIndex - The 0 based page index.outStream - The output stream to write the image to.options - Options to use when saving the image, such as the TIFF compression type.IOExceptionPDFExceptionpublic void saveDocumentAsTIFF(String fileName, double resDPI, String tiffCompression) throws PDFException, IOException
fileName - The name of the file to write the TIFF image to.resDPI - Dots per inch at which to render the image, 72 is the native PDF resolution and is equivalent to 100% scale..tiffCompression - The type of TIFF compression to use.  This value needs to be one of
 these predefined values:PDFExceptionIOExceptionpublic void saveDocumentAsTIFF(String fileName, TIFFOptions options) throws PDFException, IOException
TIFFOptions object as an argument to describe various
 TIFF options when saving the file.fileName - The name of the file to write the TIFF image to.options - Options to use when saving the TIFF file.PDFExceptionIOExceptionpublic void saveDocumentAsTIFF(OutputStream outStream, TIFFOptions options) throws PDFException, IOException
TIFFOptions object as an argument to describe various
 TIFF options when saving the file.outStream - The stream to save the image to.options - Options to use when saving the TIFF file.PDFExceptionIOExceptionpublic void appendTIFFAsPages(String tiffFileName) throws PDFException, IOException
tiffFileName - The name of the TIFF file to add to this document.PDFExceptionIOExceptionpublic void appendTIFFAsPages(InputStream inStream) throws PDFException, IOException
inStream - The input stream to read the TIFF image fromPDFExceptionIOExceptionpublic void appendJPEGAsPage(String jpegFileName) throws PDFException, IOException
jpegFileName - The name of the JPEG file to add to this document.PDFExceptionIOExceptionpublic void appendJPEGAsPage(InputStream inStream) throws PDFException, IOException
inStream - The input stream from which to read the JPEG image.PDFExceptionIOExceptionpublic void appendGIFAsPage(String gifFileName, int dpi) throws PDFException, IOException
gifFileName - The name of gif filedpi - The DPI value to use when importing the image.PDFExceptionIOExceptionpublic void appendGIFAsPage(InputStream inStream, int dpi) throws PDFException, IOException
inStream - An input stream containing the GIF file contentdpi - The DPI value to use when importing the image.PDFExceptionIOExceptionpublic void appendJPEGAsPage(String jpegFileName, int dpi) throws PDFException, IOException
jpegFileName - The name of the JPEG file to add to this document.dpi - The DPI value to use when importing the image.PDFExceptionIOExceptionpublic void appendPNGAsPage(String pngFileName) throws PDFException, IOException
pngFileName - The name of the PNG file to add to this document.PDFExceptionIOExceptionpublic void appendPNGAsPage(InputStream inStream) throws IOException, PDFException
inStream - The input stream to read the PNG content from.IOExceptionPDFExceptionpublic void saveDocument(OutputStream outStream) throws IOException, PDFException
outStream - OutputStream where the document will be written to.IOExceptionPDFExceptionpublic void saveDocument(String fileName) throws IOException, PDFException
fileName - Name of the file to save the document.IOExceptionPDFExceptionpublic void setWatermark(IWatermark watermark)
IWatermark.TYPE_IMAGES when creating images from the
 document.watermark - the IWatermark object to use when creating images
            from the PDFImages documentpublic boolean usePermissionsPassword(String ownerPassword) throws PDFException
ownerPassword - The permissions passwordPDFExceptionpublic IWatermark getWatermark()
IWatermark objectsetWatermark(com.qoppa.pdf.IWatermark)