@Deprecated public class HTMLWorker extends Object implements SimpleXMLDocHandler, DocListener
Modifier and Type | Field and Description |
---|---|
protected Paragraph |
currentParagraph
Deprecated.
Keeps the content of the current paragraph
|
protected DocListener |
document
Deprecated.
DocListener that will listen to the Elements produced by parsing the HTML.
|
static String |
FONT_PROVIDER
Deprecated.
Key used to store the font provider in the providers map.
|
static String |
IMG_BASEURL
Deprecated.
Key used to store the image baseurl provider in the providers map.
|
static String |
IMG_PROCESSOR
Deprecated.
Key used to store the image processor in the providers map.
|
static String |
IMG_PROVIDER
Deprecated.
Key used to store the image provider in the providers map.
|
static String |
IMG_STORE
Deprecated.
Key used to store the image store in the providers map.
|
static String |
LINK_PROVIDER
Deprecated.
Key used to store the link provider in the providers map.
|
protected List<Element> |
objectList
Deprecated.
The resulting list of elements.
|
protected boolean |
skipText
Deprecated.
Indicates if text needs to be skipped.
|
protected Stack<Element> |
stack
Deprecated.
Stack with the Elements that already have been processed.
|
protected Map<String,HTMLTagProcessor> |
tags
Deprecated.
The map with all the supported tags.
|
Constructor and Description |
---|
HTMLWorker(DocListener document)
Deprecated.
Creates a new instance of HTMLWorker
|
HTMLWorker(DocListener document, Map<String,HTMLTagProcessor> tags, StyleSheet style)
Deprecated.
Creates a new instance of HTMLWorker
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(Element element)
Deprecated.
Signals that an Element was added to the Document .
|
void |
carriageReturn()
Deprecated.
Flushes the current paragraph, indicating that we're starting a new block.
|
void |
close()
Deprecated.
Signals that the Document was closed and that no other Elements will be added.
|
CellWrapper |
createCell(String tag)
Deprecated.
Creates a Cell.
|
Chunk |
createChunk(String content)
Deprecated.
Creates a Chunk using the factory.
|
Image |
createImage(Map<String,String> attrs)
Deprecated.
Creates an Image object.
|
LineSeparator |
createLineSeparator(Map<String,String> attrs)
Deprecated.
Creates a LineSeparator object.
|
List |
createList(String tag)
Deprecated.
Creates a List object.
|
ListItem |
createListItem()
Deprecated.
Creates a ListItem object.
|
Paragraph |
createParagraph()
Deprecated.
Creates a Paragraph using the factory.
|
void |
endDocument()
Deprecated.
Called after the document is parsed.
|
void |
endElement(String tag)
Deprecated.
Called when an end tag is found.
|
void |
flushContent()
Deprecated.
Stacks the current paragraph, indicating that we're starting a new span.
|
Map<String,Object> |
getInterfaceProps()
Deprecated.
use getProviders() instead
|
boolean |
isInsidePRE()
Deprecated.
|
boolean |
isPendingLI()
Deprecated.
|
boolean |
isPendingTD()
Deprecated.
|
boolean |
isPendingTR()
Deprecated.
|
boolean |
isSkipText()
Deprecated.
|
void |
newLine()
Deprecated.
Adds a new line to the currentParagraph.
|
boolean |
newPage()
Deprecated.
Signals that an new page has to be started.
|
void |
open()
Deprecated.
Signals that the Document has been opened and that Elements can be added.
|
void |
parse(Reader reader)
Deprecated.
Parses content read from a java.io.Reader object.
|
static List<Element> |
parseToList(Reader reader, StyleSheet style)
Deprecated.
Parses an HTML source to a List of Element objects
|
static List<Element> |
parseToList(Reader reader, StyleSheet style, HashMap<String,Object> providers)
Deprecated.
Parses an HTML source to a List of Element objects
|
static List<Element> |
parseToList(Reader reader, StyleSheet style, Map<String,HTMLTagProcessor> tags, HashMap<String,Object> providers)
Deprecated.
Parses an HTML source to a List of Element objects
|
void |
popTableState()
Deprecated.
Pops the values of pendingTR and pendingTD from a state stack.
|
void |
processImage(Image img, Map<String,String> attrs)
Deprecated.
Processes an Image.
|
void |
processLink()
Deprecated.
Adds a link to the current paragraph.
|
void |
processList()
Deprecated.
Fetches the List from the Stack and adds it to the TextElementArray on top of the Stack, or to the Document if the Stack is empty.
|
void |
processListItem()
Deprecated.
Looks for the List object on the Stack, and adds the ListItem to the List.
|
void |
processRow()
Deprecated.
Gets the TableWrapper from the Stack and adds a new row.
|
void |
processTable()
Deprecated.
Processes the Table.
|
void |
pushTableState()
Deprecated.
Pushes the values of pendingTR and pendingTD to a state stack.
|
void |
pushToStack(Element element)
Deprecated.
Pushes an element to the Stack.
|
void |
resetPageCount()
Deprecated.
Sets the page number to 0.
|
void |
setInsidePRE(boolean insidePRE)
Deprecated.
|
void |
setInterfaceProps(HashMap<String,Object> providers)
Deprecated.
use setProviders() instead
|
boolean |
setMarginMirroring(boolean marginMirroring)
Deprecated.
Parameter that allows you to do left/right margin mirroring (odd/even pages)
|
boolean |
setMarginMirroringTopBottom(boolean marginMirroring)
Deprecated.
Parameter that allows you to do top/bottom margin mirroring (odd/even pages)
|
boolean |
setMargins(float marginLeft, float marginRight, float marginTop, float marginBottom)
Deprecated.
Sets the margins.
|
void |
setPageCount(int pageN)
Deprecated.
Sets the page number.
|
boolean |
setPageSize(Rectangle pageSize)
Deprecated.
Sets the pagesize.
|
void |
setPendingLI(boolean pendingLI)
Deprecated.
|
void |
setPendingTD(boolean pendingTD)
Deprecated.
|
void |
setPendingTR(boolean pendingTR)
Deprecated.
|
void |
setProviders(Map<String,Object> providers)
Deprecated.
Setter for the providers.
|
void |
setSkipText(boolean skipText)
Deprecated.
|
void |
setStyleSheet(StyleSheet style)
Deprecated.
Setter for the StyleSheet
|
void |
setSupportedTags(Map<String,HTMLTagProcessor> tags)
Deprecated.
Sets the map with supported tags.
|
void |
startDocument()
Deprecated.
Called when the document starts to be parsed.
|
void |
startElement(String tag, Map<String,String> attrs)
Deprecated.
Called when a start tag is found.
|
void |
text(String content)
Deprecated.
Called when a text element is found.
|
void |
updateChain(String tag)
Deprecated.
Updates the chain by removing a tag.
|
void |
updateChain(String tag, Map<String,String> attrs)
Deprecated.
Updates the chain with a new tag and new attributes.
|
protected DocListener document
protected Map<String,HTMLTagProcessor> tags
protected Stack<Element> stack
protected Paragraph currentParagraph
public static final String IMG_PROVIDER
public static final String IMG_PROCESSOR
public static final String IMG_STORE
public static final String IMG_BASEURL
public static final String FONT_PROVIDER
public static final String LINK_PROVIDER
protected boolean skipText
public HTMLWorker(DocListener document)
document
- A class that implements DocListener
public HTMLWorker(DocListener document, Map<String,HTMLTagProcessor> tags, StyleSheet style)
document
- A class that implements DocListener
tags
- A map containing the supported tags
style
- A StyleSheet
public void setSupportedTags(Map<String,HTMLTagProcessor> tags)
tags
-
public void setStyleSheet(StyleSheet style)
style
- the StyleSheet
public void parse(Reader reader) throws IOException
reader
- the content
IOException
public void startDocument()
SimpleXMLDocHandler
startDocument
in interface SimpleXMLDocHandler
SimpleXMLDocHandler.startDocument()
public void startElement(String tag, Map<String,String> attrs)
SimpleXMLDocHandler
startElement
in interface SimpleXMLDocHandler
tag
- the tag name
attrs
- the tag's attributes
SimpleXMLDocHandler.startElement(java.lang.String, java.util.Map)
public void text(String content)
SimpleXMLDocHandler
text
in interface SimpleXMLDocHandler
content
- the text element, probably a fragment.
SimpleXMLDocHandler.text(java.lang.String)
public void endElement(String tag)
SimpleXMLDocHandler
endElement
in interface SimpleXMLDocHandler
tag
- the tag name
SimpleXMLDocHandler.endElement(java.lang.String)
public void endDocument()
SimpleXMLDocHandler
endDocument
in interface SimpleXMLDocHandler
SimpleXMLDocHandler.endDocument()
public void newLine()
public void carriageReturn() throws DocumentException
DocumentException
public void flushContent()
public void pushToStack(Element element)
element
-
public void updateChain(String tag, Map<String,String> attrs)
tag
- the new tag
attrs
- the corresponding attributes
public void updateChain(String tag)
tag
- the new tag
public void setProviders(Map<String,Object> providers)
providers
- a Map with different providers
public Chunk createChunk(String content)
content
- the content of the chunk
public Paragraph createParagraph()
public List createList(String tag)
tag
- should be "ol" or "ul"
public ListItem createListItem()
public LineSeparator createLineSeparator(Map<String,String> attrs)
attrs
- properties of the LineSeparator
public Image createImage(Map<String,String> attrs) throws DocumentException, IOException
attrs
- properties of the Image
DocumentException
IOException
public CellWrapper createCell(String tag)
tag
- the tag
public void processLink()
public void processList() throws DocumentException
DocumentException
public void processListItem() throws DocumentException
DocumentException
public void processImage(Image img, Map<String,String> attrs) throws DocumentException
img
-
attrs
-
DocumentException
public void processTable() throws DocumentException
DocumentException
public void processRow()
public void pushTableState()
public void popTableState()
public boolean isPendingTR()
public void setPendingTR(boolean pendingTR)
pendingTR
- the pendingTR to set
public boolean isPendingTD()
public void setPendingTD(boolean pendingTD)
pendingTD
- the pendingTD to set
public boolean isPendingLI()
public void setPendingLI(boolean pendingLI)
pendingLI
- the pendingLI to set
public boolean isInsidePRE()
public void setInsidePRE(boolean insidePRE)
insidePRE
- the insidePRE to set
public boolean isSkipText()
public void setSkipText(boolean skipText)
skipText
- the skipText to set
public static List<Element> parseToList(Reader reader, StyleSheet style) throws IOException
reader
- the HTML source
style
- a StyleSheet object
IOException
public static List<Element> parseToList(Reader reader, StyleSheet style, HashMap<String,Object> providers) throws IOException
reader
- the HTML source
style
- a StyleSheet object
providers
- map containing classes with extra info
IOException
public static List<Element> parseToList(Reader reader, StyleSheet style, Map<String,HTMLTagProcessor> tags, HashMap<String,Object> providers) throws IOException
reader
- the HTML source
style
- a StyleSheet object
tags
- a map containing supported tags and their processors
providers
- map containing classes with extra info
IOException
public boolean add(Element element) throws DocumentException
ElementListener
Element
was added to the Document
.
add
in interface ElementListener
element
- a high level object
true
if the element was added, false
if not.
DocumentException
- when a document isn't open yet, or has been closed
ElementListener.add(com.itextpdf.text.Element)
public void close()
DocListener
Document
was closed and that no other Elements
will be added.
The outputstream of every writer implementing DocListener
will be closed.
close
in interface DocListener
DocListener.close()
public boolean newPage()
DocListener
newPage
in interface DocListener
true
if the page was added, false
if not.
DocListener.newPage()
public void open()
DocListener
Document
has been opened and that Elements
can be added.
open
in interface DocListener
DocListener.open()
public void resetPageCount()
DocListener
resetPageCount
in interface DocListener
DocListener.resetPageCount()
public boolean setMarginMirroring(boolean marginMirroring)
DocListener
setMarginMirroring
in interface DocListener
DocListener.setMarginMirroring(boolean)
public boolean setMarginMirroringTopBottom(boolean marginMirroring)
DocListener
setMarginMirroringTopBottom
in interface DocListener
DocListener.setMarginMirroring(boolean)
public boolean setMargins(float marginLeft, float marginRight, float marginTop, float marginBottom)
DocListener
setMargins
in interface DocListener
marginLeft
- the margin on the left
marginRight
- the margin on the right
marginTop
- the margin on the top
marginBottom
- the margin on the bottom
boolean
DocListener.setMargins(float, float, float, float)
public void setPageCount(int pageN)
DocListener
setPageCount
in interface DocListener
pageN
- the new page number
DocListener.setPageCount(int)
public boolean setPageSize(Rectangle pageSize)
DocListener
setPageSize
in interface DocListener
pageSize
- the new pagesize
boolean
DocListener.setPageSize(com.itextpdf.text.Rectangle)
@Deprecated public void setInterfaceProps(HashMap<String,Object> providers)
@Deprecated public Map<String,Object> getInterfaceProps()
Copyright © 2016. All rights reserved.