Class HTMLWorker
java.lang.Object
com.lowagie.text.html.simpleparser.HTMLWorker
- All Implemented Interfaces:
DocListener,ElementListener,SimpleXMLDocHandler,EventListener
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DocListenerprotected ArrayListstatic final HashMapstatic final String -
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.voidstatic ArrayListparseToList(Reader reader, StyleSheet style) static ArrayListparseToList(Reader reader, StyleSheet style, HashMap 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) booleansetMarginMirroring(boolean marginMirroring) Parameter that 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) Called when a start tag is found.voidCalled when a text element is found.
-
Field Details
-
objectList
-
document
-
tagsSupportedString
- See Also:
-
tagsSupported
-
-
Constructor Details
-
HTMLWorker
Creates a new instance of HTMLWorker- Parameters:
document- A class that implementsDocListener
-
-
Method Details
-
setStyleSheet
-
getStyleSheet
-
setInterfaceProps
-
getInterfaceProps
-
parse
- Throws:
IOException
-
parseToList
- Throws:
IOException
-
parseToList
public static ArrayList parseToList(Reader reader, StyleSheet style, HashMap interfaceProps) throws IOException - 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
Description copied from interface:SimpleXMLDocHandlerCalled when a start tag is found.- Specified by:
startElementin interfaceSimpleXMLDocHandler- Parameters:
tag- the tag nameh- 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 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:DocListenerParameter that allows you to do left/right margin mirroring (odd/even pages)- Specified by:
setMarginMirroringin interfaceDocListener- 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- 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
-