Class HTMLWorker
java.lang.Object
com.lowagie.text.html.simpleparser.HTMLWorker
- All Implemented Interfaces:
DocListener
,ElementListener
,SimpleXMLDocHandler
,AutoCloseable
,EventListener
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ChainedProperties
private Paragraph
protected DocListener
private FactoryProperties
private boolean
private boolean
private boolean
private boolean
private boolean
private StyleSheet
static final String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Signals that anElement
was added to theDocument
.void
void
close()
Signals that theDocument
was closed and that no otherElements
will be added.void
Called after the document is parsed.void
endElement
(String tag) Called when an end tag is found.boolean
newPage()
Signals that an new page has to be started.void
open()
Signals that theDocument
has been opened and thatElements
can be added.void
parseToList
(Reader reader, StyleSheet style) parseToList
(Reader reader, StyleSheet style, Map<String, Object> interfaceProps) void
Resets the footer of this document.void
Resets the header of this document.void
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.void
setInterfaceProps
(Map<String, Object> interfaceProps) boolean
setMarginMirroring
(boolean marginMirroring) Allows you to do left/right margin mirroring (odd/even pages)boolean
setMarginMirroringTopBottom
(boolean marginMirroring) Parameter that allows you to do top/bottom 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
Called when the document starts to be parsed.void
startElement
(String tag, Map<String, String> style) Called when a start tag is found.void
Called when a text element is found.
-
Field Details
-
tagsSupportedString
- See Also:
-
tagsSupported
-
objectList
-
document
-
currentParagraph
-
cprops
-
stack
-
pendingTR
private boolean pendingTR -
pendingTD
private boolean pendingTD -
pendingLI
private boolean pendingLI -
style
-
isPRE
private boolean isPRE -
tableState
-
skipText
private boolean skipText -
interfaceProps
-
factoryProperties
-
-
Constructor Details
-
HTMLWorker
Creates a new instance of HTMLWorker- Parameters:
document
- A class that implementsDocListener
-
-
Method Details
-
parseToList
- Throws:
IOException
-
parseToList
public static ArrayList<Element> parseToList(Reader reader, StyleSheet style, Map<String, Object> interfaceProps) throws IOException- Throws:
IOException
-
getStyleSheet
-
setStyleSheet
-
getInterfaceProps
-
setInterfaceProps
-
parse
- Throws:
IOException
-
endDocument
public void endDocument()Description copied from interface:SimpleXMLDocHandler
Called after the document is parsed.- Specified by:
endDocument
in interfaceSimpleXMLDocHandler
-
startDocument
public void startDocument()Description copied from interface:SimpleXMLDocHandler
Called when the document starts to be parsed.- Specified by:
startDocument
in interfaceSimpleXMLDocHandler
-
startElement
Description copied from interface:SimpleXMLDocHandler
Called when a start tag is found.- Specified by:
startElement
in interfaceSimpleXMLDocHandler
- Parameters:
tag
- the tag namestyle
- the tag's attributes
-
endElement
Description copied from interface:SimpleXMLDocHandler
Called when an end tag is found.- Specified by:
endElement
in interfaceSimpleXMLDocHandler
- Parameters:
tag
- the tag name
-
text
Description copied from interface:SimpleXMLDocHandler
Called when a text element is found.- Specified by:
text
in interfaceSimpleXMLDocHandler
- Parameters:
str
- the text element, probably a fragment.
-
add
Description copied from interface:ElementListener
Signals that anElement
was added to theDocument
.- Specified by:
add
in interfaceElementListener
- 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
-
clearTextWrap
- Throws:
DocumentException
-
close
public void close()Description copied from interface:DocListener
Signals that theDocument
was closed and that no otherElements
will be added.The outputstream of every writer implementing
DocListener
will be closed.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceDocListener
-
newPage
public boolean newPage()Description copied from interface:DocListener
Signals that an new page has to be started.- Specified by:
newPage
in interfaceDocListener
- Returns:
true
if the page was added,false
if not.
-
open
public void open()Description copied from interface:DocListener
Signals that theDocument
has been opened and thatElements
can be added.- Specified by:
open
in interfaceDocListener
-
resetHeader
public void resetHeader()Description copied from interface:DocListener
Resets the header of this document.- Specified by:
resetHeader
in interfaceDocListener
-
resetPageCount
public void resetPageCount()Description copied from interface:DocListener
Sets the page number to 0.- Specified by:
resetPageCount
in interfaceDocListener
-
setMarginMirroring
public boolean setMarginMirroring(boolean marginMirroring) Description copied from interface:DocListener
Allows you to do left/right margin mirroring (odd/even pages)- Specified by:
setMarginMirroring
in interfaceDocListener
- Parameters:
marginMirroring
- left/right margin mirroring (odd/even pages)- Returns:
- true if successful
-
setMarginMirroringTopBottom
public boolean setMarginMirroringTopBottom(boolean marginMirroring) Description copied from interface:DocListener
Parameter that allows you to do top/bottom margin mirroring (odd/even pages)- Specified by:
setMarginMirroringTopBottom
in interfaceDocListener
- Parameters:
marginMirroring
- top/bottom margin mirroring (odd/even pages)- Returns:
- true if successful
- Since:
- 2.1.6
- See Also:
-
setMargins
public boolean setMargins(float marginLeft, float marginRight, float marginTop, float marginBottom) Description copied from interface:DocListener
Sets the margins.- Specified by:
setMargins
in interfaceDocListener
- Parameters:
marginLeft
- the margin on the leftmarginRight
- the margin on the rightmarginTop
- the margin on the topmarginBottom
- the margin on the bottom- Returns:
- a
boolean
-
setPageCount
public void setPageCount(int pageN) Description copied from interface:DocListener
Sets the page number.- Specified by:
setPageCount
in interfaceDocListener
- Parameters:
pageN
- the new page number
-
setPageSize
Description copied from interface:DocListener
Sets the pagesize.- Specified by:
setPageSize
in interfaceDocListener
- Parameters:
pageSize
- the new pagesize- Returns:
- a
boolean
-