![]() | |
Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
com.lowagie.text.DocWriter
Writer
class for documents.
DocWriter
is the abstract class of several writers such
as PdfWriter
and HtmlWriter
.
A DocWriter
can be added as a DocListener
to a certain Document
by getting an instance (see method
getInstance()
in the specific writer-classes).
Every Element
added to the original Document
will be written to the OutputStream
of the listening
DocWriter
.
Document
, DocListener
Field Summary | |
static byte |
|
static byte |
|
static byte |
|
static byte |
|
static byte |
|
static byte |
|
static byte |
|
static byte |
|
protected boolean |
|
protected Document |
|
protected boolean |
|
protected OutputStreamCounter |
|
protected Rectangle |
|
protected boolean |
|
Method Summary | |
boolean | |
protected void |
|
void |
|
void |
|
static byte[] |
|
boolean |
|
boolean |
|
boolean |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
boolean |
|
boolean |
|
void |
|
boolean |
|
protected void |
|
protected void |
|
protected void |
|
protected void |
|
protected boolean |
|
protected void |
|
public static final byte EQUALS
This is some byte that is often used.
- Field Value:
- 61
public static final byte FORWARD
This is some byte that is often used.
- Field Value:
- 47
public static final byte GT
This is some byte that is often used.
- Field Value:
- 62
public static final byte LT
This is some byte that is often used.
- Field Value:
- 60
public static final byte NEWLINE
This is some byte that is often used.
- Field Value:
- 10
public static final byte QUOTE
This is some byte that is often used.
- Field Value:
- 92
public static final byte SPACE
This is some byte that is often used.
- Field Value:
- 32
public static final byte TAB
This is some byte that is often used.
- Field Value:
- 9
protected boolean closeStream
Closes the stream on document close
protected boolean open
Is the writer open for writing?
protected boolean pause
Do we have to pause all writing actions?
protected DocWriter()
protected DocWriter(Document document, OutputStream os)
Constructs aDocWriter
.
- Parameters:
document
- TheDocument
that has to be writtenos
- TheOutputStream
the writer has to write to.
public boolean add(Element element) throws DocumentException
Signals that anElement
was added to theDocument
. This method should be overriden in the specificDocWriter
classes derived from this abstract class.
- Specified by:
- add in interface ElementListener
- Parameters:
element
- A high level object to add
- Returns:
false
- Throws:
DocumentException
- when a document isn't open yet, or has been closed
protected void addTabs(int indent) throws IOException
Writes a number of tabs.
- Parameters:
indent
- the number of tabs to add
public void close()
Signals that theDocument
was closed and that no otherElements
will be added.
- Specified by:
- close in interface DocListener
public void flush()
Flushes theBufferedOutputStream
.
public static final byte[] getISOBytes(String text)
Converts aString
into aByte
array according to the ISO-8859-1 codepage.
- Parameters:
text
- the text to be converted
- Returns:
- the conversion result
public boolean isCloseStream()
Checks if the stream is to be closed on document close
- Returns:
- true if the stream is closed on documnt close
public boolean isPaused()
Checks if writing is paused.
- Returns:
true
if writing temporarely has to be paused,false
otherwise.
public boolean newPage()
Signals that an new page has to be started. This does nothing. Has to be overridden if needed.
- Specified by:
- newPage in interface DocListener
- Returns:
true
if the page was added,false
if not.
public void open()
Signals that theDocument
was opened.
- Specified by:
- open in interface DocListener
public void pause()
Let the writer know that all writing has to be paused.
public void resetFooter()
Resets the footer of this document. This method should be overriden in the specificDocWriter
classes derived from this abstract class if they actually support the use of footers.
- Specified by:
- resetFooter in interface DocListener
public void resetHeader()
Resets the header of this document. This method should be overriden in the specificDocWriter
classes derived from this abstract class if they actually support the use of headers.
- Specified by:
- resetHeader in interface DocListener
public void resetPageCount()
Sets the page number to 0. This method should be overriden in the specificDocWriter
classes derived from this abstract class if they actually support the use of pagenumbers.
- Specified by:
- resetPageCount in interface DocListener
public void resume()
Let the writer know that writing may be resumed.
public void setCloseStream(boolean closeStream)
Sets the close state of the stream after document close
- Parameters:
closeStream
- true if the stream is closed on document close
public void setFooter(HeaderFooter footer)
Changes the footer of this document. This method should be overriden in the specificDocWriter
classes derived from this abstract class if they actually support the use of footers.
- Specified by:
- setFooter in interface DocListener
- Parameters:
footer
- the new footer
public void setHeader(HeaderFooter header)
Changes the header of this document. This method should be overriden in the specificDocWriter
classes derived from this abstract class if they actually support the use of headers.
- Specified by:
- setHeader in interface DocListener
- Parameters:
header
- the new header
public boolean setMarginMirroring(boolean MarginMirroring)
- Specified by:
- setMarginMirroring in interface DocListener
public boolean setMargins(float marginLeft, float marginRight, float marginTop, float marginBottom)
Sets the margins. This does nothing. Has to be overridden if needed.
- Specified by:
- setMargins in interface DocListener
- Parameters:
marginLeft
- the margin on the leftmarginRight
- the margin on the rightmarginTop
- the margin on the topmarginBottom
- the margin on the bottom
- Returns:
false
public void setPageCount(int pageN)
Sets the page number. This method should be overriden in the specificDocWriter
classes derived from this abstract class if they actually support the use of pagenumbers.
- Specified by:
- setPageCount in interface DocListener
- Parameters:
pageN
- the new page number
public boolean setPageSize(Rectangle pageSize)
Sets the pagesize.
- Specified by:
- setPageSize in interface DocListener
- Parameters:
pageSize
- the new pagesize
- Returns:
- a
boolean
protected void write(String string) throws IOException
Writes aString
to theOutputStream
.
- Parameters:
string
- theString
to write
protected void write(String key, String value) throws IOException
Writes a key-value pair to the outputstream.
- Parameters:
key
- the name of an attributevalue
- the value of an attribute
protected void writeEnd() throws IOException
Writes an endtag to the outputstream.
protected void writeEnd(String tag) throws IOException
Writes an endtag to the outputstream.
- Parameters:
tag
- the name of the tag
protected boolean writeMarkupAttributes(Properties markup) throws IOException
Writes the markup attributes of the specifiedMarkupAttributes
object to theOutputStream
.
- Parameters:
markup
- aProperties
collection to write.
- Returns:
- true, if writing the markup attributes succeeded
protected void writeStart(String tag) throws IOException
Writes a starttag to the outputstream.
- Parameters:
tag
- the name of the tag