Class HTMLWorker
java.lang.Object
com.lowagie.text.html.simpleparser.HTMLWorker
- All Implemented Interfaces:
DocListener,ElementListener,SimpleXMLDocHandler,AutoCloseable,EventListener
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanSignals that anElementwas added to theDocument.voidvoidclose()Signals that theDocumentwas closed and that no otherElementswill be added.voidCalled after the document is parsed.voidendElement(String tag) Called when an end tag is found.booleannewPage()Signals that an new page has to be started.voidopen()Signals that theDocumenthas been opened and thatElementscan be added.voidparseToList(Reader reader, StyleSheet style) parseToList(Reader reader, StyleSheet style, HashMap interfaceProps) Deprecated.parseToList(Reader reader, StyleSheet style, Map<String, Object> interfaceProps) voidResets the footer of this document.voidResets the header of this document.voidSets the page number to 0.voidsetFooter(HeaderFooter footer) Changes the footer of this document.voidsetHeader(HeaderFooter header) Changes the header of this document.voidsetInterfaceProps(HashMap interfaceProps) Deprecated.usesetInterfaceProps(Map)since 1.2.22voidsetInterfaceProps(Map<String, Object> interfaceProps) booleansetMarginMirroring(boolean marginMirroring) Allows you to do left/right margin mirroring (odd/even pages)booleansetMarginMirroringTopBottom(boolean marginMirroring) Parameter that allows you to do top/bottom margin mirroring (odd/even pages)booleansetMargins(float marginLeft, float marginRight, float marginTop, float marginBottom) Sets the margins.voidsetPageCount(int pageN) Sets the page number.booleansetPageSize(Rectangle pageSize) Sets the pagesize.voidsetStyleSheet(StyleSheet style) voidCalled when the document starts to be parsed.voidstartElement(String tag, HashMap h) Deprecated.usestartElement(String, Map)} since 1.2.22voidstartElement(String tag, Map<String, String> style) Called when a start tag is found.voidCalled when a text element is found.
-
Field Details
-
tagsSupportedString
- See Also:
-
tagsSupported
-
objectList
-
document
-
-
Constructor Details
-
HTMLWorker
Creates a new instance of HTMLWorker- Parameters:
document- A class that implementsDocListener
-
-
Method Details
-
parseToList
- Throws:
IOException
-
parseToList
@Deprecated public static ArrayList<Element> parseToList(Reader reader, StyleSheet style, HashMap interfaceProps) throws IOException Deprecated.useparseToList(Reader, StyleSheet, Map)since 1.2.22- Parameters:
reader- the Readerstyle- the StyleSheetinterfaceProps- the interface properties- Returns:
- an ArrayList
- Throws:
IOException- on error
-
parseToList
public static ArrayList<Element> parseToList(Reader reader, StyleSheet style, Map<String, Object> interfaceProps) throws IOException- Throws:
IOException
-
getStyleSheet
-
setStyleSheet
-
getInterfaceProps
-
setInterfaceProps
Deprecated.usesetInterfaceProps(Map)since 1.2.22- Parameters:
interfaceProps- the properties of the interface
-
setInterfaceProps
-
parse
- Throws:
IOException
-
endDocument
public void endDocument()Description copied from interface:SimpleXMLDocHandlerCalled after the document is parsed.- Specified by:
endDocumentin interfaceSimpleXMLDocHandler
-
startDocument
public void startDocument()Description copied from interface:SimpleXMLDocHandlerCalled when the document starts to be parsed.- Specified by:
startDocumentin interfaceSimpleXMLDocHandler
-
startElement
Deprecated.usestartElement(String, Map)} since 1.2.22Description copied from interface:SimpleXMLDocHandlerCalled when a start tag is found.- Specified by:
startElementin interfaceSimpleXMLDocHandler- Parameters:
tag- the tag nameh- the tag's attributes
-
startElement
Description copied from interface:SimpleXMLDocHandlerCalled when a start tag is found.- Specified by:
startElementin interfaceSimpleXMLDocHandler- Parameters:
tag- the tag namestyle- the tag's attributes
-
endElement
Description copied from interface:SimpleXMLDocHandlerCalled when an end tag is found.- Specified by:
endElementin interfaceSimpleXMLDocHandler- Parameters:
tag- the tag name
-
text
Description copied from interface:SimpleXMLDocHandlerCalled when a text element is found.- Specified by:
textin interfaceSimpleXMLDocHandler- Parameters:
str- the text element, probably a fragment.
-
add
Description copied from interface:ElementListenerSignals that anElementwas added to theDocument.- Specified by:
addin interfaceElementListener- Parameters:
element- a high level object- Returns:
trueif the element was added,falseif 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:DocListenerSignals that theDocumentwas closed and that no otherElementswill be added.The outputstream of every writer implementing
DocListenerwill be closed.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceDocListener
-
newPage
public boolean newPage()Description copied from interface:DocListenerSignals that an new page has to be started.- Specified by:
newPagein interfaceDocListener- Returns:
trueif the page was added,falseif not.
-
open
public void open()Description copied from interface:DocListenerSignals that theDocumenthas been opened and thatElementscan be added.- Specified by:
openin interfaceDocListener
-
resetHeader
public void resetHeader()Description copied from interface:DocListenerResets the header of this document.- Specified by:
resetHeaderin interfaceDocListener
-
resetPageCount
public void resetPageCount()Description copied from interface:DocListenerSets the page number to 0.- Specified by:
resetPageCountin interfaceDocListener
-
setMarginMirroring
public boolean setMarginMirroring(boolean marginMirroring) Description copied from interface:DocListenerAllows you to do left/right margin mirroring (odd/even pages)- Specified by:
setMarginMirroringin interfaceDocListener- Parameters:
marginMirroring- left/right margin mirroring (odd/even pages)- Returns:
- true if successful
-
setMarginMirroringTopBottom
public boolean setMarginMirroringTopBottom(boolean marginMirroring) Description copied from interface:DocListenerParameter that allows you to do top/bottom margin mirroring (odd/even pages)- Specified by:
setMarginMirroringTopBottomin 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:DocListenerSets the margins.- Specified by:
setMarginsin 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:DocListenerSets the page number.- Specified by:
setPageCountin interfaceDocListener- Parameters:
pageN- the new page number
-
setPageSize
Description copied from interface:DocListenerSets the pagesize.- Specified by:
setPageSizein interfaceDocListener- Parameters:
pageSize- the new pagesize- Returns:
- a
boolean
-
parseToList(Reader, StyleSheet, Map)since 1.2.22