|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.itextpdf.text.html.simpleparser.HTMLWorker
public class HTMLWorker
Old iText class that allows you to convert HTML to PDF. We've completely rewritten HTML to PDF conversion and we made it a separate project named XML Worker.
| Field Summary | |
|---|---|
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 Summary | |
|---|---|
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 |
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
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
protected List<Element> objectList
| Constructor Detail |
|---|
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 DocListenertags - A map containing the supported tagsstyle - A StyleSheet| Method Detail |
|---|
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
IOExceptionpublic void startDocument()
SimpleXMLDocHandler
startDocument in interface SimpleXMLDocHandlerSimpleXMLDocHandler.startDocument()
public void startElement(String tag,
Map<String,String> attrs)
SimpleXMLDocHandler
startElement in interface SimpleXMLDocHandlertag - the tag nameattrs - the tag's attributesSimpleXMLDocHandler.startElement(java.lang.String, java.util.Map)public void text(String content)
SimpleXMLDocHandler
text in interface SimpleXMLDocHandlercontent - the text element, probably a fragment.SimpleXMLDocHandler.text(java.lang.String)public void endElement(String tag)
SimpleXMLDocHandler
endElement in interface SimpleXMLDocHandlertag - the tag nameSimpleXMLDocHandler.endElement(java.lang.String)public void endDocument()
SimpleXMLDocHandler
endDocument in interface SimpleXMLDocHandlerSimpleXMLDocHandler.endDocument()public void newLine()
public void carriageReturn()
throws DocumentException
DocumentExceptionpublic void flushContent()
public void pushToStack(Element element)
element -
public void updateChain(String tag,
Map<String,String> attrs)
tag - the new tagattrs - the corresponding attributespublic void updateChain(String tag)
tag - the new tagpublic void setProviders(Map<String,Object> providers)
providers - a Map with different providerspublic 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
IOExceptionpublic 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
DocumentExceptionpublic void processRow()
public void pushTableState()
public void popTableState()
public boolean isPendingTR()
public void setPendingTR(boolean pendingTR)
pendingTR - the pendingTR to setpublic boolean isPendingTD()
public void setPendingTD(boolean pendingTD)
pendingTD - the pendingTD to setpublic boolean isPendingLI()
public void setPendingLI(boolean pendingLI)
pendingLI - the pendingLI to setpublic boolean isInsidePRE()
public void setInsidePRE(boolean insidePRE)
insidePRE - the insidePRE to setpublic 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 sourcestyle - a StyleSheet object
IOException
public static List<Element> parseToList(Reader reader,
StyleSheet style,
HashMap<String,Object> providers)
throws IOException
reader - the HTML sourcestyle - a StyleSheet objectproviders - 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 sourcestyle - a StyleSheet objecttags - a map containing supported tags and their processorsproviders - map containing classes with extra info
IOException
public boolean add(Element element)
throws DocumentException
ElementListenerElement was added to the Document.
add in interface ElementListenerelement - a high level object
true if the element was added, false if not.
DocumentException - when a document isn't open yet, or has been closedElementListener.add(com.itextpdf.text.Element)public 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 DocListenerDocListener.close()public boolean newPage()
DocListener
newPage in interface DocListenertrue if the page was added, false if not.DocListener.newPage()public void open()
DocListenerDocument has been opened and that
Elements can be added.
open in interface DocListenerDocListener.open()public void resetPageCount()
DocListener
resetPageCount in interface DocListenerDocListener.resetPageCount()public boolean setMarginMirroring(boolean marginMirroring)
DocListener
setMarginMirroring in interface DocListenerDocListener.setMarginMirroring(boolean)public boolean setMarginMirroringTopBottom(boolean marginMirroring)
DocListener
setMarginMirroringTopBottom in interface DocListenerDocListener.setMarginMirroring(boolean)
public boolean setMargins(float marginLeft,
float marginRight,
float marginTop,
float marginBottom)
DocListener
setMargins in interface DocListenermarginLeft - the margin on the leftmarginRight - the margin on the rightmarginTop - the margin on the topmarginBottom - the margin on the bottom
booleanDocListener.setMargins(float, float, float, float)public void setPageCount(int pageN)
DocListener
setPageCount in interface DocListenerpageN - the new page numberDocListener.setPageCount(int)public boolean setPageSize(Rectangle pageSize)
DocListener
setPageSize in interface DocListenerpageSize - the new pagesize
booleanDocListener.setPageSize(com.itextpdf.text.Rectangle)@Deprecated public void setInterfaceProps(HashMap<String,Object> providers)
@Deprecated public Map<String,Object> getInterfaceProps()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||