Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.lowagie.text.rtf
Class RtfWriter2

    java.lang.Object
      com.lowagie.text.DocWriter
          com.lowagie.text.rtf.RtfWriter2

All Implemented Interfaces:
  DocListener, ElementListener, EventListener

    public class RtfWriter2

extends DocWriter

The RtfWriter allows the creation of rtf documents via the iText system Version: $Id: RtfWriter2.java 2996 2007-11-20 22:40:36Z hallm $

Author:
  Mark Hall (mhall@edu.uni-klu.ac.at)

Field Summary
`private RtfDocument` | `rtfDoc` The RtfDocument this RtfWriter is creating

Fields inherited from class com.lowagie.text.DocWriter
`closeStream, document, EQUALS, FORWARD, GT, LT, NEWLINE, open, os, pageSize, pause, QUOTE, SPACE, TAB`

Constructor Summary
`protected` | `RtfWriter2(Document doc, OutputStream os)` Constructs a new RtfWriter that listens to the specified Document and writes its output to the OutputStream.

Method Summary
`boolean` | `add(Element element)` Adds an Element to the Document
`void` | `clearTextWrap()` This method is not supported in the RtfWriter
`void` | `close()` Closes the RtfDocument.
`RtfDocumentSettings` | `getDocumentSettings()` Gets the RtfDocumentSettings that specify how the rtf document is generated.
`static RtfWriter2` | `getInstance(Document doc, OutputStream os)` Static method to generate RtfWriters
`void` | `importRtfDocument(Reader documentSource)` Adds the complete RTF document to the current RTF document being generated.
`void` | `importRtfFragment(Reader documentSource, RtfImportMappings mappings)` Adds a fragment of an RTF document to the current RTF document being generated.
`boolean` | `newPage()` Adds a page break
`void` | `open()` Opens the RtfDocument
`void` | `resetFooter()` Resets the footer
`void` | `resetHeader()` Resets the header
`void` | `resetPageCount()` This method is not supported in the RtfWriter
`void` | `setAutogenerateTOCEntries(boolean autogenerate)` Whether to automagically generate table of contents entries when adding Chapters or Sections.
`void` | `setDataCacheStyle(int dataCacheStyle)` Deprecated. As of iText 2.0.6 or earlier, replaced by `RtfDocumentSettings.setDataCacheStyle(int)` via `getDocumentSettings()`, scheduled for removal at or after 2.1.0
`void` | `setFooter(HeaderFooter hf)` Sets the footer to use
`void` | `setHeader(HeaderFooter hf)` Sets the header to use
`boolean` | `setMargins(float left, float right, float top, float bottom)` Sets the page margins
`void` | `setPageCount(int i)` This method is not supported in the RtfWriter
`boolean` | `setPageSize(Rectangle rect)` Sets the size of the page

Methods inherited from class com.lowagie.text.DocWriter
`addTabs, flush, getISOBytes, isCloseStream, isPaused, pause, resume, setCloseStream, setMarginMirroring, write, write, writeEnd, writeEnd, writeMarkupAttributes, writeStart`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### rtfDoc

    private RtfDocument rtfDoc

  The RtfDocument this RtfWriter is creating

Constructor Detail

### RtfWriter2

    protected RtfWriter2(Document doc,
                         OutputStream os)

  Constructs a new RtfWriter that listens to the specified Document and writes its output to the OutputStream.

  Parameters:
    `doc` - The Document that this RtfWriter listens to
    `os` - The OutputStream to write to

Method Detail

### getInstance

    public static RtfWriter2 getInstance(Document doc,
                                         OutputStream os)

  Static method to generate RtfWriters

  Parameters:
    `doc` - The Document that this RtfWriter listens to
    `os` - The OutputStream to write to
  Returns:
    The new RtfWriter

### setHeader

    public void setHeader(HeaderFooter hf)

  Sets the header to use

  Specified by:
    `setHeader` in interface `DocListener`
  Overrides:
    `setHeader` in class `DocWriter`
  Parameters:
    `hf` - The HeaderFooter to use

### resetHeader

    public void resetHeader()

  Resets the header

  Specified by:
    `resetHeader` in interface `DocListener`
  Overrides:
    `resetHeader` in class `DocWriter`

### setFooter

    public void setFooter(HeaderFooter hf)

  Sets the footer to use

  Specified by:
    `setFooter` in interface `DocListener`
  Overrides:
    `setFooter` in class `DocWriter`
  Parameters:
    `hf` - The HeaderFooter to use

### resetFooter

    public void resetFooter()

  Resets the footer

  Specified by:
    `resetFooter` in interface `DocListener`
  Overrides:
    `resetFooter` in class `DocWriter`

### setPageCount

    public void setPageCount(int i)

  This method is not supported in the RtfWriter

  Specified by:
    `setPageCount` in interface `DocListener`
  Overrides:
    `setPageCount` in class `DocWriter`
  Parameters:
    `i` - Unused

### resetPageCount

    public void resetPageCount()

  This method is not supported in the RtfWriter

  Specified by:
    `resetPageCount` in interface `DocListener`
  Overrides:
    `resetPageCount` in class `DocWriter`

### clearTextWrap

    public void clearTextWrap()

  This method is not supported in the RtfWriter

### open

    public void open()

  Opens the RtfDocument

  Specified by:
    `open` in interface `DocListener`
  Overrides:
    `open` in class `DocWriter`
  Throws:
    `IOException`

### close

    public void close()

  Closes the RtfDocument. This causes the document to be written to the specified OutputStream

  Specified by:
    `close` in interface `DocListener`
  Overrides:
    `close` in class `DocWriter`

### add

    public boolean add(Element element)
                throws DocumentException

  Adds an Element to the Document

  Specified by:
    `add` in interface `ElementListener`
  Overrides:
    `add` in class `DocWriter`
  Parameters:
    `element` - The element to be added
  Returns:
    `false`
  Throws:
    `DocumentException`

### newPage

    public boolean newPage()

  Adds a page break

  Specified by:
    `newPage` in interface `DocListener`
  Overrides:
    `newPage` in class `DocWriter`
  Returns:
    `false`

### setMargins

    public boolean setMargins(float left,
                              float right,
                              float top,
                              float bottom)

  Sets the page margins

  Specified by:
    `setMargins` in interface `DocListener`
  Overrides:
    `setMargins` in class `DocWriter`
  Parameters:
    `left` - The left margin
    `right` - The right margin
    `top` - The top margin
    `bottom` - The bottom margin
  Returns:
    `false`

### setPageSize

    public boolean setPageSize(Rectangle rect)

  Sets the size of the page

  Specified by:
    `setPageSize` in interface `DocListener`
  Overrides:
    `setPageSize` in class `DocWriter`
  Parameters:
    `rect` - A Rectangle representing the page
  Returns:
    `false`

### setAutogenerateTOCEntries

    public void setAutogenerateTOCEntries(boolean autogenerate)

  Whether to automagically generate table of contents entries when adding Chapters or Sections.

  Parameters:
    `autogenerate` - Whether to automatically generate TOC entries

### setDataCacheStyle

    public void setDataCacheStyle(int dataCacheStyle)

  Deprecated. As of iText 2.0.6 or earlier, replaced by `RtfDocumentSettings.setDataCacheStyle(int)` via `getDocumentSettings()`, scheduled for removal at or after 2.1.0

  Sets the rtf data cache style to use. Valid values are given in the RtfDataCache class.

  Parameters:
    `dataCacheStyle` - The style to use.
  Throws:
    `DocumentException` - If data has already been written into the data cache.
    `IOException` - If the disk cache could not be initialised.

### getDocumentSettings

    public RtfDocumentSettings getDocumentSettings()

  Gets the RtfDocumentSettings that specify how the rtf document is generated.

  Returns:
    The current RtfDocumentSettings.

### importRtfDocument

    public void importRtfDocument(Reader documentSource)
                           throws IOException,
                                  DocumentException

  Adds the complete RTF document to the current RTF document being generated. It will parse the font and color tables and correct the font and color references so that the imported RTF document retains its formattings.

  Parameters:
    `documentSource` - The Reader to read the RTF document from.
  Throws:
    `IOException` - On errors reading the RTF document.
    `DocumentException` - On errors adding to this RTF document.

### importRtfFragment

    public void importRtfFragment(Reader documentSource,
                                  RtfImportMappings mappings)
                           throws IOException,
                                  DocumentException

  Adds a fragment of an RTF document to the current RTF document being generated. Since this fragment doesn't contain font or color tables, all fonts and colors are mapped to the default font and color. If the font and color mappings are known, they can be specified via the mappings parameter.

  Parameters:
    `documentSource` - The Reader to read the RTF fragment from.
    `mappings` - The RtfImportMappings that contain font and color mappings to apply to the fragment.
  Throws:
    `IOException` - On errors reading the RTF fragment.
    `DocumentException` - On errors adding to this RTF fragment.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD