Save This Page
Home » iText-src-2.1.3 » com.lowagie » text » [javadoc | source]
com.lowagie.text
abstract public class: DocWriter [javadoc | source]
java.lang.Object
   com.lowagie.text.DocWriter

All Implemented Interfaces:
    DocListener

Direct Known Subclasses:
    HtmlWriter, PdfCopy, PdfCopyFieldsImp, Wrt, XmlWriter, PdfWriter, PdfStamperImp, RtfWriter2, RtfWriter, PdfSmartCopy

An abstract 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.

Field Summary
public static final  byte NEWLINE    This is some byte that is often used. 
public static final  byte TAB    This is some byte that is often used. 
public static final  byte LT    This is some byte that is often used. 
public static final  byte SPACE    This is some byte that is often used. 
public static final  byte EQUALS    This is some byte that is often used. 
public static final  byte QUOTE    This is some byte that is often used. 
public static final  byte GT    This is some byte that is often used. 
public static final  byte FORWARD    This is some byte that is often used. 
protected  Rectangle pageSize    The pageSize. 
protected  Document document    This is the document that has to be written. 
protected  OutputStreamCounter os    The outputstream of this writer. 
protected  boolean open    Is the writer open for writing? 
protected  boolean pause    Do we have to pause all writing actions? 
protected  boolean closeStream    Closes the stream on document close 
Constructor:
 protected DocWriter() 
 protected DocWriter(Document document,
    OutputStream os) 
    Constructs a DocWriter.
    Parameters:
    document - The Document that has to be written
    os - The OutputStream the writer has to write to.
Method from com.lowagie.text.DocWriter Summary:
add,   addTabs,   close,   flush,   getISOBytes,   isCloseStream,   isPaused,   newPage,   open,   pause,   resetFooter,   resetHeader,   resetPageCount,   resume,   setCloseStream,   setFooter,   setHeader,   setMarginMirroring,   setMargins,   setPageCount,   setPageSize,   write,   write,   writeEnd,   writeEnd,   writeMarkupAttributes,   writeStart
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from com.lowagie.text.DocWriter Detail:
 public boolean add(Element element) throws DocumentException 
    Signals that an Element was added to the Document.

    This method should be overridden in the specific DocWriter classes derived from this abstract class.

 protected  void addTabs(int indent) throws IOException 
    Writes a number of tabs.
 public  void close() 
    Signals that the Document was closed and that no other Elements will be added.
 public  void flush() 
    Flushes the BufferedOutputStream.
 public static final byte[] getISOBytes(String text) 
    Converts a String into a Byte array according to the ISO-8859-1 codepage.
 public boolean isCloseStream() 
    Checks if the stream is to be closed on document close
 public boolean isPaused() 
    Checks if writing is paused.
 public boolean newPage() 
    Signals that an new page has to be started.

    This does nothing. Has to be overridden if needed.

 public  void open() 
    Signals that the Document was opened.
 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 overridden in the specific DocWriter classes derived from this abstract class if they actually support the use of footers.

 public  void resetHeader() 
    Resets the header of this document.

    This method should be overridden in the specific DocWriter classes derived from this abstract class if they actually support the use of headers.

 public  void resetPageCount() 
    Sets the page number to 0.

    This method should be overridden in the specific DocWriter classes derived from this abstract class if they actually support the use of pagenumbers.

 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
 public  void setFooter(HeaderFooter footer) 
    Changes the footer of this document.

    This method should be overridden in the specific DocWriter classes derived from this abstract class if they actually support the use of footers.

 public  void setHeader(HeaderFooter header) 
    Changes the header of this document.

    This method should be overridden in the specific DocWriter classes derived from this abstract class if they actually support the use of headers.

 public boolean setMarginMirroring(boolean MarginMirroring) 
 public boolean setMargins(float marginLeft,
    float marginRight,
    float marginTop,
    float marginBottom) 
    Sets the margins.

    This does nothing. Has to be overridden if needed.

 public  void setPageCount(int pageN) 
    Sets the page number.

    This method should be overridden in the specific DocWriter classes derived from this abstract class if they actually support the use of pagenumbers.

 public boolean setPageSize(Rectangle pageSize) 
    Sets the pagesize.
 protected  void write(String string) throws IOException 
    Writes a String to the OutputStream.
 protected  void write(String key,
    String value) throws IOException 
    Writes a key-value pair to the outputstream.
 protected  void writeEnd() throws IOException 
    Writes an endtag to the outputstream.
 protected  void writeEnd(String tag) throws IOException 
    Writes an endtag to the outputstream.
 protected boolean writeMarkupAttributes(Properties markup) throws IOException 
    Writes the markup attributes of the specified MarkupAttributes object to the OutputStream.
 protected  void writeStart(String tag) throws IOException 
    Writes a starttag to the outputstream.