org.extex.backend.documentWriter.itextpdf
Class TwoPassDocumentWriter

java.lang.Object
  extended by org.extex.backend.documentWriter.itextpdf.TwoPassDocumentWriter
All Implemented Interfaces:
DocumentWriter, SingleDocumentStream, FontAware, Configurable, LogEnabled, ResourceAware

public class TwoPassDocumentWriter
extends java.lang.Object
implements DocumentWriter, SingleDocumentStream, Configurable, ResourceAware, LogEnabled, FontAware

Implementation of a pdf document writer with iText. The backend collect first all glyphs and after this, the backend for the pdf creation is called.

Version:
$Revision: 5957 $
Author:
Michael Niedermair

Constructor Summary
TwoPassDocumentWriter(Configuration config, DocumentWriterOptions options)
          Creates a new object.
 
Method Summary
 void close()
          This method is invoked upon the end of the processing.
 void configure(Configuration config)
          Configure an object according to a given Configuration.
 void enableLogging(java.util.logging.Logger logger)
          Setter for the logger.
 java.lang.String getExtension()
          Getter for the extension associated with this kind of output.
 void setFontFactory(CoreFontFactory factory)
          Setter for the font factory.
 void setOutputStream(java.io.OutputStream writer)
          Setter for the output stream.
 void setParameter(java.lang.String name, java.lang.String value)
          Setter for a named parameter.
 void setResourceFinder(ResourceFinder finder)
          Setter for the resource finder.
 int shipout(Page page)
          This is the entry point for the document writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TwoPassDocumentWriter

public TwoPassDocumentWriter(Configuration config,
                             DocumentWriterOptions options)
Creates a new object.

Parameters:
config - The configurations.
options - The options.
Method Detail

close

public void close()
           throws GeneralException,
                  java.io.IOException
This method is invoked upon the end of the processing.

Specified by:
close in interface DocumentWriter
Throws:
GeneralException - in case of a general exception
especially
DocumentWriterException in case of an error
java.io.IOException - in case of an IO exception
See Also:
DocumentWriter.close()

configure

public void configure(Configuration config)
               throws ConfigurationException
Configure an object according to a given Configuration.

Specified by:
configure in interface Configurable
Parameters:
config - the configuration object to consider
Throws:
ConfigurationException - in case that something went wrong
See Also:
Configurable.configure(org.extex.framework.configuration.Configuration)

enableLogging

public void enableLogging(java.util.logging.Logger logger)
Setter for the logger.

Specified by:
enableLogging in interface LogEnabled
Parameters:
logger - the logger to use
See Also:
LogEnabled.enableLogging(java.util.logging.Logger)

getExtension

public java.lang.String getExtension()
Getter for the extension associated with this kind of output. For instance pdf is the expected value for PDF files and dvi is the expected value for DVI files.

Specified by:
getExtension in interface DocumentWriter
Returns:
the appropriate extension for file names
See Also:
DocumentWriter.getExtension()

setFontFactory

public void setFontFactory(CoreFontFactory factory)
Setter for the font factory.

Specified by:
setFontFactory in interface FontAware
Parameters:
factory - the font factory
See Also:
FontAware.setFontFactory(org.extex.font.CoreFontFactory)

setOutputStream

public void setOutputStream(java.io.OutputStream writer)
Setter for the output stream.

Specified by:
setOutputStream in interface SingleDocumentStream
Parameters:
writer - the output stream
See Also:
SingleDocumentStream.setOutputStream(java.io.OutputStream)

setParameter

public void setParameter(java.lang.String name,
                         java.lang.String value)
Setter for a named parameter. Parameters are a general mechanism to influence the behavior of the document writer. Any parameter not known by the document writer has to be ignored.

Specified by:
setParameter in interface DocumentWriter
Parameters:
name - the name of the parameter
value - the value of the parameter
See Also:
DocumentWriter.setParameter(java.lang.String, java.lang.String)

setResourceFinder

public void setResourceFinder(ResourceFinder finder)
Setter for the resource finder.

Specified by:
setResourceFinder in interface ResourceAware
Parameters:
finder - the resource finder
See Also:
ResourceAware.setResourceFinder(org.extex.resource.ResourceFinder)

shipout

public int shipout(Page page)
            throws GeneralException,
                   java.io.IOException
This is the entry point for the document writer. Here it receives a complete node list to be sent to the output writer. It can be assumed that all values for width, height, and depth of the node lists are properly filled. Thus all information should be present to place the ink on the paper.

If the page is null then no page has to be shipped and 0 has to be returned.

Specified by:
shipout in interface DocumentWriter
Parameters:
page - the page to send
Returns:
returns the number of pages shipped
Throws:
GeneralException - in case of a general exception
especially
DocumentWriterException in case of an error
java.io.IOException - in case of an IO exception
See Also:
DocumentWriter.shipout(org.extex.typesetter.type.page.Page)