|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgnu.jpdf.PDFDocument
public class PDFDocument
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?
Field Summary | |
---|---|
protected PDFObject |
defaultOutlineBorder
This holds a PDFObject describing the default border for annotations. |
static int |
FULLSCREEN
This page mode indicates that when the document is opened, it is displayed in full-screen-mode. |
protected java.util.Vector |
objects
This vector contains each indirect object within the document. |
protected int |
objser
This is used to allocate objects a unique serial number in the document. |
static java.lang.String[] |
PDF_PAGE_MODES
These map the page modes just defined to the pagemodes setting of PDF. |
static int |
USENONE
This page mode indicates that the document should be opened just with the page visible. |
static int |
USEOUTLINES
This page mode indicates that the Outlines should also be displayed when the document is opened. |
static int |
USETHUMBS
This page mode indicates that the Thumbnails should be visible when the document first opens. |
Constructor Summary | |
---|---|
PDFDocument()
This creates a PDF document with the default pagemode |
|
PDFDocument(int pagemode)
This creates a PDF document |
Method Summary | |
---|---|
int |
add(PDFObject obj)
This adds a top level object to the document. |
PDFFont |
getFont(java.lang.String type,
java.lang.String font,
int style)
This returns a font of the specified type and font. |
PDFOutline |
getOutline()
|
PDFPage |
getPage(int page)
This returns a specific page. |
PDFInfo |
getPDFInfo()
Get the PDFInfo object, which contains author, title, keywords, etc |
java.lang.String |
setImageName(PDFImage img)
Sets a unique name to a PDFImage |
void |
setPDFInfo(PDFInfo info)
Set the PDFInfo object, which contains author, title, keywords, etc |
void |
write(java.io.OutputStream os)
This writes the document to an OutputStream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int objser
protected java.util.Vector objects
protected PDFObject defaultOutlineBorder
public static final int USENONE
This page mode indicates that the document should be opened just with the page visible. This is the default
public static final int USEOUTLINES
This page mode indicates that the Outlines should also be displayed when the document is opened.
public static final int USETHUMBS
This page mode indicates that the Thumbnails should be visible when the document first opens.
public static final int FULLSCREEN
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.
public static final java.lang.String[] PDF_PAGE_MODES
These map the page modes just defined to the pagemodes setting of PDF.
Constructor Detail |
---|
public PDFDocument()
This creates a PDF document with the default pagemode
public PDFDocument(int pagemode)
This creates a PDF document
pagemode
- an int, determines how the document will present itself to
the viewer when it first opens.Method Detail |
---|
public int add(PDFObject obj)
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.
obj
- The PDFObject to add to the document
public PDFPage getPage(int page)
This returns a specific page. It's used mainly when using a Serialized template file.
?? How does a serialized template file work ???
page
- page number to return
public PDFOutline getOutline()
public PDFFont getFont(java.lang.String type, java.lang.String font, int style)
type
- PDF Font Type - usually "/Type1"font
- Java font namestyle
- java.awt.Font style (NORMAL, BOLD etc)
public java.lang.String setImageName(PDFImage img)
img
- PDFImage to set the name of
public void setPDFInfo(PDFInfo info)
Set the PDFInfo object, which contains author, title, keywords, etc
public PDFInfo getPDFInfo()
Get the PDFInfo object, which contains author, title, keywords, etc
public void write(java.io.OutputStream os) throws java.io.IOException
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.
os
- OutputStream to write the document to
java.io.IOException
- on error
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |