|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.qoppa.pdfImages.PDFDocument
The PDFDocument 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.
The class can import and export the images using the file system or an output stream in
JPEG, TIFF and PNG formats and can also return a BufferedImage object to the calling
application.
| Constructor Summary | |
PDFDocument()
Creates a blank PDFDocument object. |
|
PDFDocument(InputStream inStream,
IPassword password)
Loads a PDF document from an InputStream. |
|
PDFDocument(String fileName,
IPassword password)
Loads a PDF document from a file. |
|
PDFDocument(URL url,
IPassword password)
Loads a PDF document from a URL. |
|
| Method Summary | |
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(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. |
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,
double resDPI)
Returns a BufferedImage containing a rendering of the page at the given resolution in DPI. |
BufferedImage |
getPageImage(int pageIndex,
int width,
int height)
Returns a BufferedImage containing a rendering of the page at the given page size. |
BufferedImage |
getPageSubImage(int pageIndex,
Rectangle2D pageArea,
double 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 jPDFSecure. |
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,
double resDPI,
String tiffCompression)
Save the entire document as a multi-page TIFF image to the given OutputStream. |
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,
double resDPI,
float quality)
Save the rendered image of the page to the given OutputStream in JPEG format. |
void |
savePageAsJPEG(int pageIndex,
String fileName,
double resDPI,
float quality)
Save the rendered image of the page to the given file in JPEG format. |
void |
savePageAsPNG(int pageIndex,
OutputStream outStream,
double dpi)
Save the rendered image of the page to the given OutputStream in PNG format. |
void |
savePageAsPNG(int pageIndex,
String fileName,
double dpi)
Save the rendered image of the page to the given OutputStream in PNG format. |
void |
savePageAsTIFF(int pageIndex,
OutputStream outStream,
double resDPI,
String tiffCompression)
Save the rendered image of the page to the given OutputStream in TIFF 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,
double resDPI,
String tiffCompression)
Save the rendered image of the page to the given file 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. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public PDFDocument()
throws PDFException
public PDFDocument(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.
public PDFDocument(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.
public PDFDocument(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.| Method Detail |
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,
double 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% scale
PDFException
public BufferedImage getPageImage(int pageIndex,
int width,
int height)
pageIndex - The 0 based page index.width - The width of the desired image, in pixelsheight - The height of the desired image, in pixels
public BufferedImage getPageSubImage(int pageIndex,
Rectangle2D pageArea,
double dpi)
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.
public 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)
public int getPageCount()
public void savePageAsPNG(int pageIndex,
OutputStream outStream,
double 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.
IOException
PDFException
public void savePageAsPNG(int pageIndex,
String fileName,
double 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.
IOException
PDFException
public void savePageAsJPEG(int pageIndex,
OutputStream outStream,
double 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.
IOException
PDFException
public void savePageAsJPEG(int pageIndex,
String fileName,
double 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.
IOException
PDFException
public void savePageAsTIFF(int pageIndex,
OutputStream outStream,
double resDPI,
String tiffCompression)
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.tiffCompression - The type of TIFF compression to use. This value needs to be one of
these predefined values:IOException
PDFException
public void savePageAsTIFF(int pageIndex,
String fileName,
double resDPI,
String tiffCompression)
throws IOException,
PDFException
pageIndex - The 0 based page index.fileName - The name of the file 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.tiffCompression - The type of TIFF compression to use. This value needs to be one of
these predefined values:IOException
PDFException
public 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.
IOException
PDFException
public 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.
IOException
PDFException
public void saveDocumentAsTIFF(OutputStream outStream,
double resDPI,
String tiffCompression)
throws PDFException,
IOException
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..tiffCompression - The type of TIFF compression to use. This value needs to be one of
these predefined values:PDFException
IOException
public 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:PDFException
IOException
public 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.
PDFException
IOException
public 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.
PDFException
IOException
public void appendTIFFAsPages(String tiffFileName)
throws PDFException,
IOException
tiffFileName - The name of the TIFF file to add to this document.
PDFException
IOException
public void appendTIFFAsPages(InputStream inStream)
throws PDFException,
IOException
inStream - The input stream to read the TIFF image from
PDFException
IOException
public void appendJPEGAsPage(String jpegFileName)
throws PDFException,
IOException
jpegFileName - The name of the JPEG file to add to this document.
PDFException
IOException
public void appendJPEGAsPage(String jpegFileName,
int dpi)
throws PDFException,
IOException
jpegFileName - The name of the JPEG file to add to this document.
PDFException
IOException
public void appendPNGAsPage(String pngFileName)
throws PDFException,
IOException
pngFileName - The name of the PNG file to add to this document.
PDFException
IOException
public void saveDocument(OutputStream outStream)
throws IOException,
PDFException
outStream - OutputStream where the document will be written to.
IOException
PDFException
public void saveDocument(String fileName)
throws IOException,
PDFException
fileName - Name of the file to save the document.
IOException
PDFException
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||