Main Page | Namespace List | Class Hierarchy | Class List | Class Members | Related Pages

gnu::jpdf::PDFDocument Class Reference

Collaboration diagram for gnu::jpdf::PDFDocument:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 PDFDocument ()
 PDFDocument (int pagemode)
synchronized int add (PDFObject obj)
PDFPage getPage (int page)
PDFOutline getOutline ()
PDFFont getFont (String type, String font, int style)
String setImageName (PDFImage img)
void setPDFInfo (PDFInfo info)
PDFInfo getPDFInfo ()
void write (OutputStream os) throws IOException

Static Public Attributes

final int USENONE = 0
final int USEOUTLINES = 1
final int USETHUMBS = 2
final int FULLSCREEN = 3
final String PDF_PAGE_MODES []

Protected Attributes

int objser
Vector objects
PDFObject defaultOutlineBorder

Detailed Description

This class is the base of the PDF generator. A PDFDocument class is created for a document, and each page, object, annotation, etc is added to the document. Once complete, the document can be written to an OutputStream, and the PDF document's internal structures are kept in sync.

Note that most programmers using this package will NEVER access one of these objects directly. Most everything can be done using PDFJob and PDFGraphics, so you don't need to directly instantiate a PDFDocument

ezb - 20011115 - Wondering if the constructors should even be public. When would someone want to make one of these and manipulate it outside the context of a job and graphics object?

Author:
Peter T Mount, http://www.retep.org.uk/pdf/

Eric Z. Beard, ericzbeard@hotmail.com

Author
ezb
Version:
Revision
1.2
,
Date
2001/11/15 20:18:11


Constructor & Destructor Documentation

gnu::jpdf::PDFDocument::PDFDocument  )  [inline]
 

This creates a PDF document with the default pagemode

gnu::jpdf::PDFDocument::PDFDocument int  pagemode  )  [inline]
 

This creates a PDF document

Parameters:
pagemode an int, determines how the document will present itself to the viewer when it first opens.


Member Function Documentation

synchronized int gnu::jpdf::PDFDocument::add PDFObject  obj  )  [inline]
 

This adds a top level object to the document.

Once added, it is allocated a unique serial number.

Note: Not all object are added directly using this method. Some objects which have Kids (in PDF sub-objects or children are called Kids) will have their own add() method, which will call this one internally.

Parameters:
obj The PDFObject to add to the document
Returns:
the unique serial number for this object.

PDFFont gnu::jpdf::PDFDocument::getFont String  type,
String  font,
int  style
[inline]
 

This returns a font of the specified type and font. If the font has not been defined, it creates a new font in the PDF document, and returns it.

Parameters:
type PDF Font Type - usually "/Type1"
font Java font name
style java.awt.Font style (NORMAL, BOLD etc)
Returns:
PDFFont defining this font

PDFOutline gnu::jpdf::PDFDocument::getOutline  )  [inline]
 

Returns:
the root outline

PDFPage gnu::jpdf::PDFDocument::getPage int  page  )  [inline]
 

This returns a specific page. It's used mainly when using a Serialized template file.

?? How does a serialized template file work ???

Parameters:
page page number to return
Returns:
PDFPage at that position

PDFInfo gnu::jpdf::PDFDocument::getPDFInfo  )  [inline]
 

Get the PDFInfo object, which contains author, title, keywords, etc

String gnu::jpdf::PDFDocument::setImageName PDFImage  img  )  [inline]
 

Sets a unique name to a PDFImage

Parameters:
img PDFImage to set the name of
Returns:
the name given to the image

void gnu::jpdf::PDFDocument::setPDFInfo PDFInfo  info  )  [inline]
 

Set the PDFInfo object, which contains author, title, keywords, etc

void gnu::jpdf::PDFDocument::write OutputStream  os  )  throws IOException [inline]
 

This writes the document to an OutputStream.

Note: You can call this as many times as you wish, as long as the calls are not running at the same time.

Also, objects can be added or amended between these calls.

Also, the OutputStream is not closed, but will be flushed on completion. It is up to the caller to close the stream.

Parameters:
os OutputStream to write the document to
Exceptions:
IOException on error


Member Data Documentation

PDFObject gnu::jpdf::PDFDocument::defaultOutlineBorder [protected]
 

This holds a PDFObject describing the default border for annotations. It's only used when the document is being written.

final int gnu::jpdf::PDFDocument::FULLSCREEN = 3 [static]
 

This page mode indicates that when the document is opened, it is displayed in full-screen-mode. There is no menu bar, window controls nor any other window present.

Vector gnu::jpdf::PDFDocument::objects [protected]
 

This vector contains each indirect object within the document.

int gnu::jpdf::PDFDocument::objser [protected]
 

This is used to allocate objects a unique serial number in the document.

final String gnu::jpdf::PDFDocument::PDF_PAGE_MODES[] [static]
 

Initial value:

 {
    "/UseNone",
    "/UseOutlines",
    "/UseThumbs",
    "/FullScreen"
  }
These map the page modes just defined to the pagemodes setting of PDF.

final int gnu::jpdf::PDFDocument::USENONE = 0 [static]
 

This page mode indicates that the document should be opened just with the page visible. This is the default

final int gnu::jpdf::PDFDocument::USEOUTLINES = 1 [static]
 

This page mode indicates that the Outlines should also be displayed when the document is opened.

final int gnu::jpdf::PDFDocument::USETHUMBS = 2 [static]
 

This page mode indicates that the Thumbnails should be visible when the document first opens.


The documentation for this class was generated from the following file:
Generated on Wed Jan 19 16:58:06 2005 by  doxygen 1.3.9.1