de.dante.extex.backend.documentWriter.dump
Class DumpDocumentWriter

java.lang.Object
  extended byde.dante.extex.backend.documentWriter.dump.DumpDocumentWriter
All Implemented Interfaces:
Configurable, DocumentWriter, PdftexSupport, SingleDocumentStream

public class DumpDocumentWriter
extends java.lang.Object
implements DocumentWriter, SingleDocumentStream, PdftexSupport, Configurable

This is an implementation of a document writer which can act both as sample and as tool for testing.

Version:
$Revision: 1.6 $
Author:
Gerd Neugebauer

Constructor Summary
DumpDocumentWriter(DocumentWriterOptions opts)
          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.
 PdfAnnotation getAnnotation(RuleNode node, java.lang.String annotation)
          Factory method to construct a PdfAnnotation node.
 java.lang.String getExtension()
          Getter for the extension associated with this kind of output.
 PdfObject getObject(java.lang.String attr, boolean isStream, java.lang.String text)
          Factory method to construct a PdfObject node.
 PdfXForm getXForm(java.lang.String attr, java.lang.String resources, Box box)
          Factory method to construct a PdfXForm node.
 PdfRefXImage getXImage(java.lang.String resource, RuleNode rule, java.lang.String attr, long page, boolean immediate)
          Factory method to construct a PdfXImage node.
 void pdfcatalog(java.lang.String text, ActionSpec action)
          Add some material to the PDF catalog.
 java.lang.String pdffontname(Font font)
          Retrieve the font name for a given font.
 long pdffontobjnum(Font font)
          Retrieve the font object number for a given font.
 void pdfincludechars(Font font, java.lang.String text)
          Include a set of characters from a font into the output regardless of whether they are used or not.
 void pdfinfo(java.lang.String text)
          This method inserts the text to the info section.
 long pdflastannot()
          Retrieve the object index of the last annotation.
 long pdflastobj()
          Retrieve the object index of the last object.
 long pdflastxform()
          Retrieve the object index of the last XForm.
 long pdflastximage()
          Retrieve the object index of the last XImage.
 void pdfnames(java.lang.String text)
          This method inserts the text to /Names array.
 void pdfoutline(ActionSpec action, long count, java.lang.String text)
          Insert some outline into the PDF output.
 void setOutputStream(java.io.OutputStream outStream)
          Setter for the output stream.
 void setParameter(java.lang.String name, java.lang.String value)
          Setter for a named parameter.
 void setTree(boolean tree)
          Setter for tree.
 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

DumpDocumentWriter

public DumpDocumentWriter(DocumentWriterOptions opts)
Creates a new object.

Parameters:
opts - the dynamic access to the context
Method Detail

close

public void close()
           throws java.io.IOException
Description copied from interface: DocumentWriter
This method is invoked upon the end of the processing.

Specified by:
close in interface DocumentWriter
Throws:
java.io.IOException - in case of an IO exception
See Also:
DocumentWriter.close()

configure

public void configure(Configuration config)
               throws ConfigurationException
Description copied from interface: Configurable
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( de.dante.util.framework.configuration.Configuration)

getAnnotation

public PdfAnnotation getAnnotation(RuleNode node,
                                   java.lang.String annotation)
                            throws InterpreterException
Description copied from interface: PdftexSupport
Factory method to construct a PdfAnnotation node.

Specified by:
getAnnotation in interface PdftexSupport
Parameters:
node - the rule specification. Only the width height and depth are relevant. Either of them can be null.
annotation - the annotation text
Returns:
a PdfAnnotation node
Throws:
InterpreterException - in case of an error
See Also:
PdftexSupport.getAnnotation(de.dante.extex.typesetter.type.node.RuleNode, java.lang.String)

getExtension

public java.lang.String getExtension()
Description copied from interface: DocumentWriter
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()

getObject

public PdfObject getObject(java.lang.String attr,
                           boolean isStream,
                           java.lang.String text)
                    throws InterpreterException
Description copied from interface: PdftexSupport
Factory method to construct a PdfObject node.

Specified by:
getObject in interface PdftexSupport
Parameters:
attr - the attribute text. This can be null
isStream - boolean indicator to signal that a stream object or file object is requested
text - the object
Returns:
a PdfObject node
Throws:
InterpreterException - in case of an error
See Also:
PdftexSupport.getObject(java.lang.String, boolean, java.lang.String)

getXForm

public PdfXForm getXForm(java.lang.String attr,
                         java.lang.String resources,
                         Box box)
                  throws InterpreterException
Description copied from interface: PdftexSupport
Factory method to construct a PdfXForm node.

Specified by:
getXForm in interface PdftexSupport
Parameters:
attr - the attribute text. This can be null
resources - the resources specification
box - the content
Returns:
a PdfXForm node
Throws:
InterpreterException - in case of an error
See Also:
PdftexSupport.getXForm(java.lang.String, java.lang.String, de.dante.extex.interpreter.type.box.Box)

getXImage

public PdfRefXImage getXImage(java.lang.String resource,
                              RuleNode rule,
                              java.lang.String attr,
                              long page,
                              boolean immediate)
                       throws InterpreterException
Description copied from interface: PdftexSupport
Factory method to construct a PdfXImage node.

Specified by:
getXImage in interface PdftexSupport
Parameters:
resource - the resource specification
rule - the rule specification. Only the width height and depth are relevant. Either of them can be null.
attr - the attribute text. This can be null
page - the page number
immediate - the indicator that the image should be put into the PDF output without waiting for a reference
Returns:
a PdfXImage node
Throws:
InterpreterException - in case of an error
See Also:
PdftexSupport.getXImage(java.lang.String, de.dante.extex.typesetter.type.node.RuleNode, java.lang.String, long, boolean)

pdfcatalog

public void pdfcatalog(java.lang.String text,
                       ActionSpec action)
Description copied from interface: PdftexSupport
Add some material to the PDF catalog.

Specified by:
pdfcatalog in interface PdftexSupport
Parameters:
text - the text for the catalog
action - the action specification. This parameter can be null
See Also:
PdftexSupport.pdfcatalog(java.lang.String, de.dante.extex.interpreter.primitives.pdftex.util.action.ActionSpec)

pdffontname

public java.lang.String pdffontname(Font font)
Description copied from interface: PdftexSupport
Retrieve the font name for a given font. For instance if a font is addressed as /F12 then this method returns 12.

Specified by:
pdffontname in interface PdftexSupport
Parameters:
font - the font to query
Returns:
the name used by PDF for the font
See Also:
PdftexSupport.pdffontname(de.dante.extex.interpreter.type.font.Font)

pdffontobjnum

public long pdffontobjnum(Font font)
Description copied from interface: PdftexSupport
Retrieve the font object number for a given font.

Specified by:
pdffontobjnum in interface PdftexSupport
Parameters:
font - the font to query
Returns:
the object number
See Also:
PdftexSupport.pdffontobjnum(de.dante.extex.interpreter.type.font.Font)

pdfincludechars

public void pdfincludechars(Font font,
                            java.lang.String text)
Description copied from interface: PdftexSupport
Include a set of characters from a font into the output regardless of whether they are used or not.

Specified by:
pdfincludechars in interface PdftexSupport
Parameters:
font - the font
text - the set of characters to include
See Also:
PdftexSupport.pdfincludechars(de.dante.extex.interpreter.type.font.Font, java.lang.String)

pdfinfo

public void pdfinfo(java.lang.String text)
Description copied from interface: PdftexSupport
This method inserts the text to the info section.

Specified by:
pdfinfo in interface PdftexSupport
Parameters:
text - the text to add
See Also:
PdftexSupport.pdfinfo(java.lang.String)

pdflastannot

public long pdflastannot()
Description copied from interface: PdftexSupport
Retrieve the object index of the last annotation.

Specified by:
pdflastannot in interface PdftexSupport
Returns:
the last annotation index or -1 if none
See Also:
PdftexSupport.pdflastannot()

pdflastobj

public long pdflastobj()
Description copied from interface: PdftexSupport
Retrieve the object index of the last object.

Specified by:
pdflastobj in interface PdftexSupport
Returns:
the last object index or -1 if none
See Also:
PdftexSupport.pdflastobj()

pdflastxform

public long pdflastxform()
Description copied from interface: PdftexSupport
Retrieve the object index of the last XForm.

Specified by:
pdflastxform in interface PdftexSupport
Returns:
the last XForm index or -1 if none
See Also:
PdftexSupport.pdflastxform()

pdflastximage

public long pdflastximage()
Description copied from interface: PdftexSupport
Retrieve the object index of the last XImage.

Specified by:
pdflastximage in interface PdftexSupport
Returns:
the last XImage index or -1 if none
See Also:
PdftexSupport.pdflastximage()

pdfnames

public void pdfnames(java.lang.String text)
Description copied from interface: PdftexSupport
This method inserts the text to /Names array.

Specified by:
pdfnames in interface PdftexSupport
Parameters:
text - the text to add
See Also:
PdftexSupport.pdfnames(java.lang.String)

pdfoutline

public void pdfoutline(ActionSpec action,
                       long count,
                       java.lang.String text)
Description copied from interface: PdftexSupport
Insert some outline into the PDF output.

Specified by:
pdfoutline in interface PdftexSupport
Parameters:
action - the action specification
count - the count
text - the text
See Also:
PdftexSupport.pdfoutline(de.dante.extex.interpreter.primitives.pdftex.util.action.ActionSpec, long, java.lang.String)

setOutputStream

public void setOutputStream(java.io.OutputStream outStream)
Description copied from interface: SingleDocumentStream
Setter for the output stream.

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

setParameter

public void setParameter(java.lang.String name,
                         java.lang.String value)
Description copied from interface: DocumentWriter
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)

setTree

public void setTree(boolean tree)
Setter for tree.

Parameters:
tree - the tree to set

shipout

public int shipout(Page page)
            throws DocumentWriterException
Description copied from interface: DocumentWriter
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.

Specified by:
shipout in interface DocumentWriter
Parameters:
page - the page to send
Returns:
returns the number of pages shipped
Throws:
DocumentWriterException
See Also:
DocumentWriter.shipout( de.dante.extex.typesetter.type.page.Page)