com.adobe.acrobat
Class PDFDocument

java.lang.Object
  |
  +--com.adobe.acrobat.PDFDocument

public class PDFDocument
extends java.lang.Object

Beans-level interface to a ui-less PDF document.

Version:
1.0 5 October 1998 Copyright (c) 1998, Adobe Systems Inc., All Rights Reserved.

Field Summary
static java.lang.String Author_K
          The info dictionary key for a PDFDocument's author.
static java.lang.String CreationDate_K
          The info dictionary key for a PDFDocument's creation date.
static java.lang.String Creator_K
          The info dictionary key for a PDFDocument's creator.
static java.lang.String Keywords_K
          The info dictionary key for a PDFDocument's keywords.
static java.lang.String ModDate_K
          The info dictionary key for a PDFDocument's last modification date.
static java.lang.String Producer_K
          The info dictionary key for a PDFDocument's producer.
static java.lang.String Subject_K
          The info dictionary key for a PDFDocument's subject.
static java.lang.String Title_K
          The info dictionary key for a PDFDocument's title.
 
Constructor Summary
PDFDocument(ByteArraySource bas)
          Create a PDFDocument from the given ByteArraySource.
PDFDocument(java.io.File file)
          Create a PDFDocument from the given File.
PDFDocument(java.net.URL url)
          Create a PDFDocument from the given URL.
 
Method Summary
 void drawPage(int pageNum, java.awt.Image image, AffineTransform transform, java.awt.Rectangle clipRect, java.awt.Component component)
          Draw the contents of the given page number into the given Image object through the given AffineTransform.
 java.lang.String getDocumentInfo(java.lang.String key)
          Get the entry in this PDFDocument's info dictionary as a String.
 java.util.Calendar getDocumentInfoDate(java.lang.String key)
          Get the entry in this PDFDocument's info dictionary as a Calendar.
 int getNumPages()
          Get the number of pages in this PDFDocument.
 com.adobe.acrobat.sidecar.FloatPoint getPageSize(int pageNum)
          Get the size of the given page, in page space.
 PDFBookmark getRootBookmark()
          Get the PDFBookmark that is the root of this PDFDocument's bookmark tree.
 com.adobe.acrobat.pdfobjstore.PDFObjStore getStore()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Author_K

public static final java.lang.String Author_K
The info dictionary key for a PDFDocument's author.

CreationDate_K

public static final java.lang.String CreationDate_K
The info dictionary key for a PDFDocument's creation date.

ModDate_K

public static final java.lang.String ModDate_K
The info dictionary key for a PDFDocument's last modification date.

Creator_K

public static final java.lang.String Creator_K
The info dictionary key for a PDFDocument's creator.

Producer_K

public static final java.lang.String Producer_K
The info dictionary key for a PDFDocument's producer.

Title_K

public static final java.lang.String Title_K
The info dictionary key for a PDFDocument's title.

Subject_K

public static final java.lang.String Subject_K
The info dictionary key for a PDFDocument's subject.

Keywords_K

public static final java.lang.String Keywords_K
The info dictionary key for a PDFDocument's keywords.
Constructor Detail

PDFDocument

public PDFDocument(java.net.URL url)
            throws java.lang.Exception
Create a PDFDocument from the given URL.
Parameters:
url - the URL containing the PDF document's contents
Throws:
java.lang.Exception - arbitrary exceptions may be thrown

PDFDocument

public PDFDocument(java.io.File file)
            throws java.lang.Exception
Create a PDFDocument from the given File.
Parameters:
file - the File containing the PDF document's contents
Throws:
java.lang.Exception - arbitrary exceptions may be thrown

PDFDocument

public PDFDocument(ByteArraySource bas)
            throws java.lang.Exception
Create a PDFDocument from the given ByteArraySource.
Parameters:
the - ByteArraySource containing the PDF document's contents
Throws:
java.lang.Exception - arbitrary exceptions may be thrown
Method Detail

getNumPages

public int getNumPages()
                throws java.lang.Exception
Get the number of pages in this PDFDocument.
Returns:
the number of pages
Throws:
java.lang.Exception - arbitrary exceptions may be thrown

getPageSize

public com.adobe.acrobat.sidecar.FloatPoint getPageSize(int pageNum)
                                                 throws java.lang.Exception
Get the size of the given page, in page space. The x value of the resulting FloatPoint is the width, and the y value is the height. The width and height are evaluated after transforming the page through the default transform.
Parameters:
pageNum - the number of the page whose size
Returns:
the page size in user space
Throws:
java.lang.Exception - arbitrary exceptions may be thrown

getStore

public com.adobe.acrobat.pdfobjstore.PDFObjStore getStore()

drawPage

public void drawPage(int pageNum,
                     java.awt.Image image,
                     AffineTransform transform,
                     java.awt.Rectangle clipRect,
                     java.awt.Component component)
              throws java.lang.Exception
Draw the contents of the given page number into the given Image object through the given AffineTransform.
Parameters:
pageNum - the page number to draw
Image - the image in which the drawing occurs
transform - the transformation matrix from user space to device space
clipRect - the Rectangle to which all drawing should be clipped (in device space). This parameter may be null, in which case drawing is clipped only to the page's crop box.
comp - a Component object that must be provided by the caller so that the rendering engine can create its own Image objects
Throws:
java.lang.Exception - arbitrary exceptions may be thrown.

getDocumentInfo

public java.lang.String getDocumentInfo(java.lang.String key)
                                 throws java.lang.Exception
Get the entry in this PDFDocument's info dictionary as a String.
Parameters:
key - the key being looked up, e.g., Author_K, Producer_K, etc.
Returns:
the value of the given key in this PDFDocument's info dictionary, or null if the key is not present.
Throws:
com.adobe.acrobat.pdfobjstore.UnexpectedTypeException - if the entry is not a String
java.lang.Exception - arbitrary exceptions may be thrown

getDocumentInfoDate

public java.util.Calendar getDocumentInfoDate(java.lang.String key)
                                       throws java.lang.Exception
Get the entry in this PDFDocument's info dictionary as a Calendar.
Parameters:
key - the key being looked up, e.g., ModDate_K, CreationDate_K, etc.
Returns:
the value of the given key in this PDFDocument's info dictionary as a Calendar object, or null if the key is not present or not a parseable date.
Throws:
com.adobe.acrobat.pdfobjstore.UnexpectedTypeException - if the entry is not a String
java.lang.Exception - arbitrary exceptions may be thrown

getRootBookmark

public PDFBookmark getRootBookmark()
                            throws java.lang.Exception
Get the PDFBookmark that is the root of this PDFDocument's bookmark tree.
Returns:
this PDFDocument's bookmark tree's root
Throws:
java.lang.Exception - arbitrary exceptions may be thrown