com.lowagie.text.html.simpleparser

Class HTMLWorker

Implemented Interfaces:
DocListener, ElementListener, EventListener, SimpleXMLDocHandler

public class HTMLWorker
extends java.lang.Object
implements SimpleXMLDocHandler, DocListener

Field Summary

ChainedProperties
cprops
Paragraph
currentParagraph
DocListener
document
boolean
isPRE
ArrayList
objectList
boolean
pendingLI
boolean
pendingP
boolean
pendingTD
boolean
pendingTR
boolean
skipText
Stack
stack
StyleSheet
style
Stack
tableState
static HashMap
tagsSupported
static String
tagsSupportedString

Constructor Summary

HTMLWorker(DocListener document)
Creates a new instance of HTMLWorker

Method Summary

boolean
add(Element element)
Signals that an Element was added to the Document.
boolean
add(Watermark watermark)
Signals that a Watermark was added to the Document.
void
clearTextWrap()
Clears text wrapping around images (if applicable).
void
close()
Signals that the Document was closed and that no other Elements will be added.
void
endDocument()
void
endElement(String tag)
boolean
newPage()
Signals that an new page has to be started.
void
open()
Signals that the Document has been opened and that Elements can be added.
void
parse(Reader reader)
static ArrayList
parseToList(Reader reader, StyleSheet style)
void
removeWatermark()
Signals that a Watermark was removed from the Document.
void
resetFooter()
Resets the footer of this document.
void
resetHeader()
Resets the header of this document.
void
resetPageCount()
Sets the page number to 0.
void
setFooter(HeaderFooter footer)
Changes the footer of this document.
void
setHeader(HeaderFooter header)
Changes the header of this document.
boolean
setMarginMirroring(boolean marginMirroring)
Parameter that allows you to do margin mirroring (odd/even pages)
boolean
setMargins(float marginLeft, float marginRight, float marginTop, float marginBottom)
Sets the margins.
void
setPageCount(int pageN)
Sets the page number.
boolean
setPageSize(Rectangle pageSize)
Sets the pagesize.
void
setStyleSheet(StyleSheet style)
void
startDocument()
void
startElement(String tag, HashMap h)
void
text(String str)

Field Details

cprops

public ChainedProperties cprops

currentParagraph

public Paragraph currentParagraph

document

public DocListener document

isPRE

public boolean isPRE

objectList

public ArrayList objectList

pendingLI

public boolean pendingLI

pendingP

public boolean pendingP

pendingTD

public boolean pendingTD

pendingTR

public boolean pendingTR

skipText

public boolean skipText

stack

public Stack stack

style

public StyleSheet style

tableState

public Stack tableState

tagsSupported

public static final HashMap tagsSupported

tagsSupportedString

public static final String tagsSupportedString

Constructor Details

HTMLWorker

public HTMLWorker(DocListener document)
Creates a new instance of HTMLWorker

Method Details

add

public boolean add(Element element)
            throws DocumentException
Signals that an Element was added to the Document.
Specified by:
add in interface ElementListener
Parameters:
element - a high level object
Returns:
true if the element was added, false if not.
Throws:
DocumentException - when a document isn't open yet, or has been closed

add

public boolean add(Watermark watermark)
Signals that a Watermark was added to the Document.
Specified by:
add in interface DocListener
Parameters:
watermark - the Watermark object
Returns:
true if the element was added, false if not.

clearTextWrap

public void clearTextWrap()
            throws DocumentException
Clears text wrapping around images (if applicable). Method suggested by Pelikan Stephan
Specified by:
clearTextWrap in interface DocListener

close

public void close()
Signals that the Document was closed and that no other Elements will be added.

The outputstream of every writer implementing DocListener will be closed.

Specified by:
close in interface DocListener

endDocument

public void endDocument()
Specified by:
endDocument in interface SimpleXMLDocHandler

endElement

public void endElement(String tag)
Specified by:
endElement in interface SimpleXMLDocHandler

newPage

public boolean newPage()
            throws DocumentException
Signals that an new page has to be started.
Specified by:
newPage in interface DocListener
Returns:
true if the page was added, false if not.
Throws:
DocumentException - when a document isn't open yet, or has been closed

open

public void open()
Signals that the Document has been opened and that Elements can be added.
Specified by:
open in interface DocListener

parse

public void parse(Reader reader)
            throws IOException

parseToList

public static ArrayList parseToList(Reader reader,
                                    StyleSheet style)
            throws IOException

removeWatermark

public void removeWatermark()
Signals that a Watermark was removed from the Document.
Specified by:
removeWatermark in interface DocListener

resetFooter

public void resetFooter()
Resets the footer of this document.
Specified by:
resetFooter in interface DocListener

resetHeader

public void resetHeader()
Resets the header of this document.
Specified by:
resetHeader in interface DocListener

resetPageCount

public void resetPageCount()
Sets the page number to 0.
Specified by:
resetPageCount in interface DocListener

setFooter

public void setFooter(HeaderFooter footer)
Changes the footer of this document.
Specified by:
setFooter in interface DocListener
Parameters:
footer - the new footer

setHeader

public void setHeader(HeaderFooter header)
Changes the header of this document.
Specified by:
setHeader in interface DocListener
Parameters:
header - the new header

setMarginMirroring

public boolean setMarginMirroring(boolean marginMirroring)
Parameter that allows you to do margin mirroring (odd/even pages)
Specified by:
setMarginMirroring in interface DocListener
Parameters:
marginMirroring -
Returns:
true if succesfull

setMargins

public boolean setMargins(float marginLeft,
                          float marginRight,
                          float marginTop,
                          float marginBottom)
Sets the margins.
Specified by:
setMargins in interface DocListener
Parameters:
marginLeft - the margin on the left
marginRight - the margin on the right
marginTop - the margin on the top
marginBottom - the margin on the bottom
Returns:
a boolean

setPageCount

public void setPageCount(int pageN)
Sets the page number.
Specified by:
setPageCount in interface DocListener
Parameters:
pageN - the new page number

setPageSize

public boolean setPageSize(Rectangle pageSize)
Sets the pagesize.
Specified by:
setPageSize in interface DocListener
Parameters:
pageSize - the new pagesize
Returns:
a boolean

setStyleSheet

public void setStyleSheet(StyleSheet style)

startDocument

public void startDocument()
Specified by:
startDocument in interface SimpleXMLDocHandler

startElement

public void startElement(String tag,
                         HashMap h)
Specified by:
startElement in interface SimpleXMLDocHandler

text

public void text(String str)
Specified by:
text in interface SimpleXMLDocHandler