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

gnu::jpdf::PDFJob Class Reference

Collaboration diagram for gnu::jpdf::PDFJob:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 PDFJob ()
 PDFJob (OutputStream os)
 PDFJob (OutputStream os, String title)
Graphics getGraphics (int orient)
void end ()
Graphics getGraphics ()
Dimension getPageDimension ()
int getPageResolution ()
boolean lastPageFirst ()
PDFDocument getPDFDocument ()
PDFPage getCurrentPage ()
int getCurrentPageNumber ()
PDFOutline addOutline (String title)
PDFOutline addOutline (String title, int x, int y, int w, int h)
PDFAnnot addNote (String note, int x, int y, int w, int h)

Protected Attributes

transient OutputStream os
PDFDocument pdfDocument
PDFPage page
int pagenum

Detailed Description

This class extends awt's PrintJob, to provide a simple method of writing PDF documents.

You can use this with any code that uses Java's printing mechanism. It does include a few extra methods to provide access to some of PDF's features like annotations, or outlines.

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::PDFJob::PDFJob  )  [inline]
 

This constructs the job. This method must be used when creating a template pdf file, ie one that is Serialised by one application, and then restored by another.

ezb 20011115 - Haven't done anything with templates yet, don't know how/if they are implemented

gnu::jpdf::PDFJob::PDFJob OutputStream  os  )  [inline]
 

This constructs the job. This is the primary constructor that will be used for creating pdf documents with this package. The specified output stream is a handle to the .pdf file you wish to create.

Parameters:
os - OutputStream to use for the pdf output

gnu::jpdf::PDFJob::PDFJob OutputStream  os,
String  title
[inline]
 

This constructs the job. This is the primary constructor that will be used for creating pdf documents with this package. The specified output stream is a handle to the .pdf file you wish to create.

Use this constructor if you want to give the pdf document a name other than the default of "PDF Doc"

Parameters:
os - OutputStream to use for the pdf output
title a String value


Member Function Documentation

PDFAnnot gnu::jpdf::PDFJob::addNote String  note,
int  x,
int  y,
int  w,
int  h
[inline]
 

Convenience method: Adds a text note to the document.

Parameters:
note Text of the note
x Coordinate of note
y Coordinate of note
w Width of the note
h Height of the note
Returns:
Returns the annotation, so other settings can be changed.

PDFOutline gnu::jpdf::PDFJob::addOutline String  title,
int  x,
int  y,
int  w,
int  h
[inline]
 

This method attaches an outline to the current page being generated. When selected, the outline displays the specified region.

Parameters:
title Outline title to attach
x Left coordinate of region
y Top coordinate of region
w width of region
h height of region
Returns:
the PDFOutline object created, for adding sub-outline's if required.

PDFOutline gnu::jpdf::PDFJob::addOutline String  title  )  [inline]
 

This method attaches an outline to the current page being generated. When selected, the outline displays the top of the page.

Parameters:
title a String, the title of the Outline
Returns:
a PDFOutline object that was created, for adding sub-outline's if required.

void gnu::jpdf::PDFJob::end  )  [inline]
 

This writes the PDF document to the OutputStream, finishing the document.

PDFPage gnu::jpdf::PDFJob::getCurrentPage  )  [inline]
 

Returns the current PDFPage being worked on. Useful for working on Annotations (like links), etc.

Returns:
the PDFPage currently being constructed

int gnu::jpdf::PDFJob::getCurrentPageNumber  )  [inline]
 

Returns the current page number. Useful if you need to include one in the document

Returns:
the int current page number

Graphics gnu::jpdf::PDFJob::getGraphics  )  [inline]
 

This returns a graphics object that can be used to draw on a page. In PDF, this will be a new page within the document.

This new page will by default be oriented as a portrait

Returns:
a Graphics object to draw to.

Graphics gnu::jpdf::PDFJob::getGraphics int  orient  )  [inline]
 

This returns a graphics object that can be used to draw on a page. In PDF, this will be a new page within the document.

Parameters:
orient - the int Orientation of the new page, as defined in PDFPage
Returns:
Graphics object to draw.
See also:
gnu.jpdf.PDFPage::PORTRAIT

gnu.jpdf.PDFPage::LANDSCAPE

gnu.jpdf.PDFPage::INVERTEDPORTRAIT

gnu.jpdf.PDFPage::SEASCAPE

Dimension gnu::jpdf::PDFJob::getPageDimension  )  [inline]
 

Returns the page dimension

Returns:
a Dimension instance, the size of the page

int gnu::jpdf::PDFJob::getPageResolution  )  [inline]
 

This returns the page resolution.

This is the PDF (and Postscript) device resolution of 72 dpi (equivalent to 1 point).

Returns:
an int, the resolution in pixels per inch

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

Returns the PDFDocument object for this document. Useful for gaining access to the internals of PDFDocument.

Returns:
the PDF object

boolean gnu::jpdf::PDFJob::lastPageFirst  )  [inline]
 

In AWT's PrintJob, this would return true if the user requested that the file is printed in reverse order. For PDF's this is not applicable, so it will always return false.

Returns:
false


Member Data Documentation

transient OutputStream gnu::jpdf::PDFJob::os [protected]
 

This is the OutputStream the PDF file will be written to when complete Note: This is transient, as it's not valid after being Serialized.

PDFPage gnu::jpdf::PDFJob::page [protected]
 

This is the current page being constructed by the last getGraphics() call

int gnu::jpdf::PDFJob::pagenum [protected]
 

This is the page number of the current page

PDFDocument gnu::jpdf::PDFJob::pdfDocument [protected]
 

This is the PDF file being constructed


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