adams.core.io
Class PDFGenerator

java.lang.Object
  extended by adams.core.io.PDFGenerator

public class PDFGenerator
extends Object

A helper class for PDF generation.

Version:
$Revision: 4584 $
Author:
fracpete (fracpete at waikato dot ac dot nz)

Nested Class Summary
static class PDFGenerator.PageOrientation
          The orientation in the document.
static class PDFGenerator.PageSize
          Enumeration of all possible page sizes.
 
Field Summary
protected  com.itextpdf.text.Document m_Document
          the documentation that is being worked on.
protected  PlaceholderFile m_Output
          the output file.
protected  PDFGenerator.PageOrientation m_PageOrientation
          the page orientation.
protected  PDFGenerator.PageSize m_PageSize
          the page size.
protected  AbstractPdfProclet[] m_Proclets
          the PDF processors.
protected  AbstractPdfProclet.DocumentState m_State
          the document state.
 
Constructor Summary
PDFGenerator()
          Initializes the PDF generator.
 
Method Summary
 void addFile(File file)
          Adds the file.
 void addFiles(File[] files)
          Adds the files.
 void close()
          Closes the document again.
protected  com.itextpdf.text.Rectangle determinePageSize()
          Returns the PageSize object based on the current setup.
 PlaceholderFile getOutput()
          Returns the output file.
 PDFGenerator.PageOrientation getPageOrientation()
          Returns the page orientation.
 PDFGenerator.PageSize getPageSize()
          Returns the page size.
 AbstractPdfProclet[] getProclets()
          Returns the processors.
protected  boolean isOpen()
          Checks whether the document is still open.
 void open()
          Opens the document for writing.
protected  void reset()
          Resets the variables and counters.
protected  void resetState()
          Resets the counters.
protected  void resetVariables()
          Resets the variables.
 void setOutput(PlaceholderFile value)
          Sets the output file.
 void setPageOrientation(PDFGenerator.PageOrientation value)
          Sets the page orientation.
 void setPageSize(PDFGenerator.PageSize value)
          Sets the page size.
 void setProclets(AbstractPdfProclet[] value)
          Sets the processors.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_Output

protected PlaceholderFile m_Output
the output file.


m_PageSize

protected PDFGenerator.PageSize m_PageSize
the page size.


m_PageOrientation

protected PDFGenerator.PageOrientation m_PageOrientation
the page orientation.


m_Proclets

protected AbstractPdfProclet[] m_Proclets
the PDF processors.


m_Document

protected com.itextpdf.text.Document m_Document
the documentation that is being worked on.


m_State

protected AbstractPdfProclet.DocumentState m_State
the document state.

Constructor Detail

PDFGenerator

public PDFGenerator()
Initializes the PDF generator.

Method Detail

reset

protected void reset()
Resets the variables and counters.


resetVariables

protected void resetVariables()
Resets the variables.


resetState

protected void resetState()
Resets the counters.


setPageSize

public void setPageSize(PDFGenerator.PageSize value)
Sets the page size.

Parameters:
value - the size

getPageSize

public PDFGenerator.PageSize getPageSize()
Returns the page size.

Returns:
the size

setPageOrientation

public void setPageOrientation(PDFGenerator.PageOrientation value)
Sets the page orientation.

Parameters:
value - the orientation

getPageOrientation

public PDFGenerator.PageOrientation getPageOrientation()
Returns the page orientation.

Returns:
the orientation

setOutput

public void setOutput(PlaceholderFile value)
Sets the output file.

Parameters:
value - the file

getOutput

public PlaceholderFile getOutput()
Returns the output file.

Returns:
the file

setProclets

public void setProclets(AbstractPdfProclet[] value)
Sets the processors.

Parameters:
value - the processors

getProclets

public AbstractPdfProclet[] getProclets()
Returns the processors.

Returns:
the processors

determinePageSize

protected com.itextpdf.text.Rectangle determinePageSize()
Returns the PageSize object based on the current setup.

Returns:
the page size rectangle

open

public void open()
          throws Exception
Opens the document for writing.

Throws:
Exception - if opening fails

isOpen

protected boolean isOpen()
Checks whether the document is still open.

Returns:
true if the document is still open

addFile

public void addFile(File file)
             throws Exception
Adds the file. Chooses the type of import based on the extension of the file.

Parameters:
file - the file to add
Throws:
Exception - if adding fails

addFiles

public void addFiles(File[] files)
              throws Exception
Adds the files. Chooses the type of import based on the extension of the file.

Parameters:
files - the files to add
Throws:
Exception - if adding fails

close

public void close()
Closes the document again.



Copyright © 2013 University of Waikato, Hamilton, NZ. All Rights Reserved.