public class HTMLWorker extends Object implements SimpleXMLDocHandler, DocListener
| Modifier and Type | Field and Description |
|---|---|
protected DocListener |
document |
protected ArrayList<Element> |
objectList |
static Map<String,Object> |
tagsSupported |
static String |
tagsSupportedString |
| Constructor and Description |
|---|
HTMLWorker(DocListener document)
Creates a new instance of HTMLWorker
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(Element element)
Signals that an
Element was added to the Document. |
void |
clearTextWrap() |
void |
close()
Signals that the
Document was closed and that no other
Elements will be added. |
void |
endDocument()
Called after the document is parsed.
|
void |
endElement(String tag)
Called when an end tag is found.
|
Map<String,Object> |
getInterfaceProps() |
StyleSheet |
getStyleSheet() |
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<Element> |
parseToList(Reader reader,
StyleSheet style) |
static ArrayList<Element> |
parseToList(Reader reader,
StyleSheet style,
HashMap interfaceProps)
Deprecated.
use
parseToList(Reader, StyleSheet, Map) since 1.2.22 |
static ArrayList<Element> |
parseToList(Reader reader,
StyleSheet style,
Map<String,Object> interfaceProps) |
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.
|
void |
setInterfaceProps(HashMap interfaceProps)
Deprecated.
use
HTMLWorker#setInterfaceProps(Map since 1.2.22 |
void |
setInterfaceProps(Map<String,Object> interfaceProps) |
boolean |
setMarginMirroring(boolean marginMirroring)
Parameter that 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 |
startDocument()
Called when the document starts to be parsed.
|
void |
startElement(String tag,
HashMap h)
Deprecated.
use
HTMLWorker#startElement(String, Map } since 1.2.22 |
void |
startElement(String tag,
Map<String,String> style)
Called when a start tag is found.
|
void |
text(String str)
Called when a text element is found.
|
public static final String tagsSupportedString
protected DocListener document
public HTMLWorker(DocListener document)
document - A class that implements DocListenerpublic static ArrayList<Element> parseToList(Reader reader, StyleSheet style) throws IOException
IOException@Deprecated public static ArrayList<Element> parseToList(Reader reader, @Nullable StyleSheet style, HashMap interfaceProps) throws IOException
parseToList(Reader, StyleSheet, Map) since 1.2.22IOExceptionpublic static ArrayList<Element> parseToList(Reader reader, @Nullable StyleSheet style, Map<String,Object> interfaceProps) throws IOException
IOExceptionpublic StyleSheet getStyleSheet()
public void setStyleSheet(StyleSheet style)
@Deprecated public void setInterfaceProps(HashMap interfaceProps)
HTMLWorker#setInterfaceProps(Map) since 1.2.22public void parse(Reader reader) throws IOException
IOExceptionpublic void endDocument()
SimpleXMLDocHandlerendDocument in interface SimpleXMLDocHandlerpublic void startDocument()
SimpleXMLDocHandlerstartDocument in interface SimpleXMLDocHandler@Deprecated public void startElement(String tag, HashMap h)
HTMLWorker#startElement(String, Map) } since 1.2.22SimpleXMLDocHandlerstartElement in interface SimpleXMLDocHandlertag - the tag nameh - the tag's attributespublic void startElement(String tag, Map<String,String> style)
SimpleXMLDocHandlerstartElement in interface SimpleXMLDocHandlertag - the tag namestyle - the tag's attributespublic void endElement(String tag)
SimpleXMLDocHandlerendElement in interface SimpleXMLDocHandlertag - the tag namepublic void text(String str)
SimpleXMLDocHandlertext in interface SimpleXMLDocHandlerstr - the text element, probably a fragment.public boolean add(Element element) throws DocumentException
ElementListenerElement was added to the Document.add in interface ElementListenerelement - a high level objecttrue if the element was added, false if not.DocumentException - when a document isn't open yet, or has been closedpublic void clearTextWrap()
throws DocumentException
DocumentExceptionpublic void close()
DocListenerDocument was closed and that no other
Elements will be added.
The outputstream of every writer implementing DocListener will be closed.
close in interface DocListenerpublic boolean newPage()
DocListenernewPage in interface DocListenertrue if the page was added, false if not.public void open()
DocListenerDocument has been opened and that
Elements can be added.open in interface DocListenerpublic void resetFooter()
DocListenerresetFooter in interface DocListenerpublic void resetHeader()
DocListenerresetHeader in interface DocListenerpublic void resetPageCount()
DocListenerresetPageCount in interface DocListenerpublic void setFooter(HeaderFooter footer)
DocListenersetFooter in interface DocListenerfooter - the new footerpublic void setHeader(HeaderFooter header)
DocListenersetHeader in interface DocListenerheader - the new headerpublic boolean setMarginMirroring(boolean marginMirroring)
DocListenersetMarginMirroring in interface DocListenerpublic boolean setMarginMirroringTopBottom(boolean marginMirroring)
DocListenersetMarginMirroringTopBottom in interface DocListenerDocListener.setMarginMirroring(boolean)public boolean setMargins(float marginLeft,
float marginRight,
float marginTop,
float marginBottom)
DocListenersetMargins in interface DocListenermarginLeft - the margin on the leftmarginRight - the margin on the rightmarginTop - the margin on the topmarginBottom - the margin on the bottombooleanpublic void setPageCount(int pageN)
DocListenersetPageCount in interface DocListenerpageN - the new page numberpublic boolean setPageSize(Rectangle pageSize)
DocListenersetPageSize in interface DocListenerpageSize - the new pagesizebooleanCopyright © 2019. All rights reserved.