com.lowagie.text.rtf
Class RtfWriter

java.lang.Object
  extended by com.lowagie.text.DocWriter
      extended by com.lowagie.text.rtf.RtfWriter
All Implemented Interfaces:
DocListener, ElementListener, EventListener

Deprecated. The RtfWriter is deprecated and will be removed from the iText library end of 2007

public class RtfWriter
extends DocWriter
implements DocListener

If you are creating a new project using the rtf part of iText, please consider using the new RtfWriter2. The RtfWriter is in bug-fix-only mode, will be deprecated end of 2005 and removed end of 2007. A DocWriter class for Rich Text Files (RTF).

A RtfWriter can be added as a DocListener to a certain Document by getting an instance. Every Element added to the original Document will be written to the OutputStream of this RtfWriter.

Example:

 // creation of the document with a certain size and certain margins
 Document document = new Document(PageSize.A4, 50, 50, 50, 50);
 try {
    // this will write RTF to the Standard OutputStream
    RtfWriter.getInstance(document, System.out);
    // this will write Rtf to a file called text.rtf
    RtfWriter.getInstance(document, new FileOutputStream("text.rtf"));
    // this will write Rtf to for instance the OutputStream of a HttpServletResponse-object
    RtfWriter.getInstance(document, response.getOutputStream());
 }
 catch(DocumentException de) {
    System.err.println(de.getMessage());
 }
 // this will close the document and all the OutputStreams listening to it
 document.close();
 

LIMITATIONS
There are currently still a few limitations on what the RTF Writer can do:


Author:
Mark.Hall@myrealbox.com, Steffen Stundzig, Eric Mattes, Raul Wegmann

Field Summary
static byte[] alignCenter
          Deprecated. Text alignment center tag.
static byte[] alignJustify
          Deprecated. Text alignment justify tag.
static byte[] alignLeft
          Deprecated. Text alignment left tag.
static byte[] alignRight
          Deprecated. Text alignment right tag.
private static byte[] annotation
          Deprecated. Annotation text tag.
private static byte[] annotationAuthor
          Deprecated. Annotation Author tag.
private static byte[] annotationID
          Deprecated. Annotation ID tag.
private static byte[] ansi
          Deprecated. RTF encoding.
private static byte[] ansiCodepage
          Deprecated. RTF encoding codepage.
protected static byte bold
          Deprecated. Bold tag.
static byte closeGroup
          Deprecated. This is the character for closing a group.
private static byte[] colorBlue
          Deprecated. Blue value tag.
private static byte[] colorGreen
          Deprecated. Green value tag.
private  ArrayList colorList
          Deprecated. This ArrayList contains all colours used in the document.
private static byte[] colorRed
          Deprecated. Red value tag.
private static byte[] colorTable
          Deprecated. Begin colour table tag.
private static byte commaDelimiter
          Deprecated. This is another delimiter between RTF tags and normal text.
private  ByteArrayOutputStream content
          Deprecated. This ByteArrayOutputStream contains the main body of the document.
private  int currentListID
          Deprecated. Current list ID.
private static byte[] day
          Deprecated. Day tag.
private static byte[] defaultFont
          Deprecated. Default Font.
protected static byte delimiter
          Deprecated. This is the delimiter between RTF tags and normal text.
private static byte[] docBegin
          Deprecated. RTF begin and version.
private static byte[] endSuperSub
          Deprecated. End super/sub script.
static byte escape
          Deprecated. This is the escape character which introduces RTF tags.
private static byte[] extendedEscape
          Deprecated. This is another escape character which introduces RTF tags.
private static byte[] facingPages
          Deprecated. Facing pages tag
protected static byte[] field
          Deprecated. Begin field tag
protected static byte[] fieldContent
          Deprecated. Content fo the field
protected static byte[] fieldDisplay
          Deprecated. Last page number (not used)
protected static byte[] fieldHyperlink
          Deprecated. HYPERLINK field
protected static byte[] fieldPage
          Deprecated. PAGE numbers
private static byte[] firstIndent
          Deprecated. First indent tag.
private static byte[] fontArial
          Deprecated. Font Arial tag.
private static byte[] fontCharset
          Deprecated. Font charset tag.
protected static byte[] fontColor
          Deprecated. Font color tag.
private static byte[] fontCourier
          Deprecated. Font Courier tag.
private  ArrayList fontList
          Deprecated. This ArrayList contains all fonts used in the document.
private static byte[] fontModern
          Deprecated. Modern font tag.
protected static byte fontNumber
          Deprecated. Font number tag.
private static byte[] fontRoman
          Deprecated. Roman font tag.
protected static byte[] fontSize
          Deprecated. Font size tag.
private static byte[] fontSwiss
          Deprecated. Swiss font tag.
private static byte[] fontSymbol
          Deprecated. Font Symbol tag.
private static byte[] fontTable
          Deprecated. Begin the font table tag.
private static byte[] fontTech
          Deprecated. Tech font tag.
private static byte[] fontTimesNewRoman
          Deprecated. Font Times New Roman tag.
private static byte[] fontWindings
          Deprecated. Font Windings tag.
private  HeaderFooter footer
          Deprecated. Document footer.
private static byte[] footerBegin
          Deprecated. Begin footer group tag.
private static byte[] footerfBegin
          Deprecated.  
private static byte[] footerlBegin
          Deprecated.  
private static byte[] footerrBegin
          Deprecated.  
private  boolean hasTitlePage
          Deprecated. Special title page
private  HeaderFooter header
          Deprecated. Document header.
private static byte[] headerBegin
          Deprecated. Begin header group tag.
private static byte[] headerfBegin
          Deprecated.  
private static byte[] headerlBegin
          Deprecated.  
private static byte[] headerrBegin
          Deprecated.  
private static byte[] hour
          Deprecated. Hour tag.
private static byte[] hybridList
          Deprecated. RTF Writer outputs hybrid lists
private  ByteArrayOutputStream info
          Deprecated. This ByteArrayOutputStream contains the information group.
private static byte[] infoBegin
          Deprecated. Begin the info group tag.
private  boolean inHeaderFooter
          Deprecated. Currently writing either Header or Footer
private  boolean inTable
          Deprecated. Currently writing a Table
protected static byte italic
          Deprecated. Italic tag.
private  boolean landscape
          Deprecated. Landscape or Portrait Document
private static byte[] landscapeTag1
          Deprecated. Document Landscape tag 1.
private static byte[] landscapeTag2
          Deprecated. Document Landscape tag 2.
private static byte[] listBegin
          Deprecated. Actual list begin
private static byte[] listBulletOld
          Deprecated. Old Bullet Style
private static byte[] listCurrentLevel
          Deprecated. Current list level
private static byte[] listDefinition
          Deprecated. Begin a List definition
private static byte[] listID
          Deprecated. Current List ID
private  ArrayList listIds
          Deprecated. List of current Lists.
private static byte[] listIndent
          Deprecated. Left indent tag.
private  int listLevel
          Deprecated. Current List Level.
private static byte[] listLevelAlignNew
          Deprecated. Level alignment (new)
private static byte[] listLevelAlignOld
          Deprecated. Level alignment (old)
private static byte[] listLevelDefinition
          Deprecated. Current List level
private static byte[] listLevelNumbers
          Deprecated. Filler for Level Numbers
private static byte[] listLevelNumbersDefinition
          Deprecated. Level Numbers Definition
private static byte[] listLevelStartAt
          Deprecated. Level starting number
private static byte[] listLevelTextDefinition
          Deprecated. Level text group
private static byte[] listLevelTextLength
          Deprecated. Filler for Level Text Length
private static byte[] listLevelTextStyleBullet
          Deprecated. Level Text Bullet Style
private static byte[] listLevelTextStyleNumbers
          Deprecated. Level Text Numbering Style
private static byte[] listLevelTypeNew
          Deprecated. Level numbering (new)
private static byte[] listLevelTypeOld
          Deprecated. Level numbering (old)
private  ByteArrayOutputStream listoverride
          Deprecated. This ByteArrayOutputStream contains the list override table.
private static byte[] listOverride
          Deprecated. List override
private static byte[] listOverrideCount
          Deprecated. Number of overrides
private static byte[] listoverridetableGroup
          Deprecated. Begin the List Override Table
private  ByteArrayOutputStream listtable
          Deprecated. This ByteArrayOutputStream contains the list table.
private static byte[] listtableGroup
          Deprecated. Begin the List Table
private static byte[] listTemplateID
          Deprecated. List Template ID
private static byte[] listTextOld
          Deprecated. List text group for older browsers
private  int marginBottom
          Deprecated. Bottom margin.
private  int marginLeft
          Deprecated. Left margin.
private  int marginRight
          Deprecated. Right margin.
private  int marginTop
          Deprecated. Top margin.
private  int maxListLevel
          Deprecated. Current maximum List Level.
private static byte[] metaAuthor
          Deprecated. Author tag.
private static byte[] metaCreationDate
          Deprecated. Creation Date tag.
private static byte[] metaKeywords
          Deprecated. Keywords tag.
private static byte[] metaProducer
          Deprecated. Producer tag.
private static byte[] metaSubject
          Deprecated. Subject tag.
private static byte[] metaTitle
          Deprecated. Title tag.
private static byte[] minute
          Deprecated. Minute tag.
private static byte[] month
          Deprecated. Month tag.
private static byte[] newPage
          Deprecated. New Page tag.
static byte openGroup
          Deprecated. This is the character for beginning a new group.
private  int pageHeight
          Deprecated. Page height.
private  int pageWidth
          Deprecated. Page width.
static byte[] paragraph
          Deprecated. Begin new paragraph tag.
static byte[] paragraphDefaults
          Deprecated. Reset paragraph defaults tag.
private static byte[] picture
          Deprecated. Begin the picture tag
private static byte[] pictureBMP
          Deprecated. BMP Image
private static byte[] pictureGroup
          Deprecated. Begin the main Picture group tag
private static byte[] pictureHeight
          Deprecated. Picture height
private static byte[] pictureJPEG
          Deprecated. JPEG Image
private static byte[] picturePNG
          Deprecated. PNG Image
private static byte[] pictureScaleX
          Deprecated. Picture scale horizontal percent
private static byte[] pictureScaleY
          Deprecated. Picture scale vertical percent
private static byte[] pictureWidth
          Deprecated. Picture width
private static byte[] pictureWMF
          Deprecated. WMF Image
private static byte[] rightIndent
          Deprecated. Right indent tag.
private static byte[] rtfMarginBottom
          Deprecated. Margin bottom tag.
private static byte[] rtfMarginLeft
          Deprecated. Margin left tag.
private static byte[] rtfMarginRight
          Deprecated. Margin right tag.
private static byte[] rtfMarginTop
          Deprecated. Margin top tag.
private static byte[] rtfPaperHeight
          Deprecated. Paper height tag.
private static byte[] rtfPaperWidth
          Deprecated. Paper width tag.
private static byte[] second
          Deprecated. Second tag.
private static byte[] section
          Deprecated. Begin new section tag.
private static byte[] sectionDefaults
          Deprecated. Reset section defaults tag.
static byte[] sectionPageHeight
          Deprecated. Page height of a section.
static byte[] sectionPageWidth
          Deprecated. Page width of a section.
private static byte[] startSub
          Deprecated. Start subscript.
private static byte[] startSuper
          Deprecated. Start superscript.
protected static byte[] strikethrough
          Deprecated. Strikethrough tag.
private static byte[] tab
          Deprecated. Tab
private static byte[] tabStop
          Deprecated. Tab Stop
private static byte[] titlePage
          Deprecated. Title Page tag
static double TWIPSFACTOR
          Deprecated. Factor to use when converting.
protected static byte[] underline
          Deprecated. Underline tag.
private  boolean writeTOC
          Deprecated. Write a TOC
private static byte[] year
          Deprecated. Year tag.
 
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 RtfWriter(Document doc, OutputStream os)
          Deprecated. Constructs a RtfWriter.
 
Method Summary
 boolean add(Element element)
          Deprecated. Signals that an Element was added to the Document.
protected  int addColor(Color newColor)
          Deprecated. Add a new Color to the list of colours.
protected  boolean addElement(Element element, ByteArrayOutputStream out)
          Deprecated. Adds an Element to the Document.
protected  int addFont(Font newFont)
          Deprecated. Add a new Font to the list of fonts.
private  void addHeaderFooterFontColor(HeaderFooter hf)
          Deprecated.  
 void close()
          Deprecated. Signals that the Document was closed and that no other Elements will be added.
static String filterSpecialChar(String str, boolean useHex)
          Deprecated. Replaces special characters with their unicode values
 boolean getGeneratingTOCEntries()
          Deprecated. Gets the current setting of writeTOC
 boolean getHasTitlePage()
          Deprecated. Gets the current setting of hasTitlePage
static RtfWriter getInstance(Document document, OutputStream os)
          Deprecated. Gets an instance of the RtfWriter.
 boolean getLandscape()
          Deprecated. Returns the current landscape setting
private  int getRandomInt()
          Deprecated. Get a random integer.
private  void initDefaults()
          Deprecated. Initialise all helper classes.
 boolean newPage()
          Deprecated. Tells the RtfWriter that a new page is to be begun.
 void open()
          Deprecated. Signals that the Document has been opened and that Elements can be added.
private  boolean parseFormat(Rectangle pageSize, boolean rotate)
          Deprecated. This method tries to fit the Rectangle pageSize to one of the predefined PageSize rectangles.
private  void processHeaderFooter(HeaderFooter hf)
          Deprecated.  
private  boolean rectEquals(Rectangle rect1, Rectangle rect2)
          Deprecated. This method compares to Rectangles.
 void resetFooter()
          Deprecated. Resets the footer.
 void resetHeader()
          Deprecated. Resets the header.
 void setFooter(HeaderFooter footer)
          Deprecated. Adds the footer to the bottom of the Document.
 void setGenerateTOCEntries(boolean writeTOC)
          Deprecated. This method controls whether TOC entries are automatically generated
 void setHasTitlePage(boolean hasTitlePage)
          Deprecated. This method controls whether the first page is a title page
 void setHeader(HeaderFooter header)
          Deprecated. Adds the header to the top of the Document.
 void setLandscape(boolean landscape)
          Deprecated. Explicitly sets the page format to use.
 boolean setMarginMirroring(boolean MarginMirroring)
          Deprecated. Parameter that allows you to do margin mirroring (odd/even pages)
 boolean setMargins(float marginLeft, float marginRight, float marginTop, float marginBottom)
          Deprecated. Sets the page margins
 boolean setPageSize(Rectangle pageSize)
          Deprecated. Sets the page size
private  void writeAnchor(Anchor anchor, ByteArrayOutputStream out)
          Deprecated. Write an Anchor.
private  void writeAnnotation(Annotation annotationElement, ByteArrayOutputStream out)
          Deprecated. Write an Annotation
private  void writeChunk(Chunk chunk, ByteArrayOutputStream out)
          Deprecated. Write a Chunk and all its font properties.
private  void writeColorList()
          Deprecated. Write the colour list to the final ByteArrayOutputStream
private  boolean writeDocument()
          Deprecated. Merge all the different ArrayLists and ByteArrayOutputStreams to the final ByteArrayOutputStream
private  void writeDocumentFormat()
          Deprecated. Write the Document's Paper and Margin Size to the final ByteArrayOutputStream
private  void writeDocumentIntro()
          Deprecated. Write the Rich Text file settings
protected  void writeFinishingFontSignature(OutputStream out, Chunk chunk)
          Deprecated.  
private  void writeFontList()
          Deprecated. Write the font list to the final ByteArrayOutputStream
private  void writeFormatedDateTime(String date)
          Deprecated. Writes a date.
private  void writeHeaderFooter(HeaderFooter headerFooter, byte[] hfType, ByteArrayOutputStream target)
          Deprecated. Write a HeaderFooter to a ByteArrayOutputStream
 void writeHeadersFooters(ByteArrayOutputStream os)
          Deprecated. Write the current header and footer to a ByteArrayOutputStream
private  void writeImage(Image image, ByteArrayOutputStream out)
          Deprecated. Write an Image.
private  void writeInfoGroup()
          Deprecated. Write the Information Group to the final ByteArrayOutputStream
protected  void writeInitialFontSignature(OutputStream out, Chunk chunk)
          Deprecated.  
static void writeInt(OutputStream out, int i)
          Deprecated. Write an integer
private  void writeList()
          Deprecated. Write the listtable and listoverridetable to the final ByteArrayOutputStream
private  void writeList(List list, ByteArrayOutputStream out)
          Deprecated. Write a List
private  void writeListElement(ListItem listItem, ByteArrayOutputStream out)
          Deprecated. Write a ListItem
private  void writeMeta(byte[] metaName, Meta meta)
          Deprecated. Add a Meta element.
private  void writeParagraph(Paragraph paragraphElement, ByteArrayOutputStream out)
          Deprecated. Write the beginning of a new Paragraph
private  void writePhrase(Phrase phrase, ByteArrayOutputStream out)
          Deprecated. Write a Phrase.
private  void writeSection(Section sectionElement, ByteArrayOutputStream out)
          Deprecated. Write the beginning of a new Section
private  void writeSectionDefaults(ByteArrayOutputStream out)
          Deprecated. Writes the default values for the current Section
private  void writeTable(Table table, ByteArrayOutputStream out)
          Deprecated. Write a Table.
 boolean writeTOC(String tocTitle, Font titleFont, boolean showTOCasEntry, Font showTOCEntryFont)
          Deprecated. Write the table of contents.
 boolean writingHeaderFooter()
          Deprecated. Returns whether we are currently writing a header or footer
 
Methods inherited from class com.lowagie.text.DocWriter
add, addTabs, clearTextWrap, flush, getISOBytes, hasMarkupAttributes, isCloseStream, pause, removeWatermark, resetPageCount, resume, setCloseStream, setPageCount, write, write, writeEnd, writeEnd, writeMarkupAttributes, writeStart
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.lowagie.text.DocListener
add, clearTextWrap, removeWatermark, resetPageCount, setPageCount
 

Field Detail

escape

public static final byte escape
Deprecated. 
This is the escape character which introduces RTF tags.

See Also:
Constant Field Values

extendedEscape

private static final byte[] extendedEscape
Deprecated. 
This is another escape character which introduces RTF tags.


delimiter

protected static final byte delimiter
Deprecated. 
This is the delimiter between RTF tags and normal text.

See Also:
Constant Field Values

commaDelimiter

private static final byte commaDelimiter
Deprecated. 
This is another delimiter between RTF tags and normal text.

See Also:
Constant Field Values

openGroup

public static final byte openGroup
Deprecated. 
This is the character for beginning a new group.

See Also:
Constant Field Values

closeGroup

public static final byte closeGroup
Deprecated. 
This is the character for closing a group.

See Also:
Constant Field Values

docBegin

private static final byte[] docBegin
Deprecated. 
RTF begin and version.


ansi

private static final byte[] ansi
Deprecated. 
RTF encoding.


ansiCodepage

private static final byte[] ansiCodepage
Deprecated. 
RTF encoding codepage.


fontTable

private static final byte[] fontTable
Deprecated. 
Begin the font table tag.


fontNumber

protected static final byte fontNumber
Deprecated. 
Font number tag.

See Also:
Constant Field Values

fontSize

protected static final byte[] fontSize
Deprecated. 
Font size tag.


fontColor

protected static final byte[] fontColor
Deprecated. 
Font color tag.


fontModern

private static final byte[] fontModern
Deprecated. 
Modern font tag.


fontSwiss

private static final byte[] fontSwiss
Deprecated. 
Swiss font tag.


fontRoman

private static final byte[] fontRoman
Deprecated. 
Roman font tag.


fontTech

private static final byte[] fontTech
Deprecated. 
Tech font tag.


fontCharset

private static final byte[] fontCharset
Deprecated. 
Font charset tag.


fontCourier

private static final byte[] fontCourier
Deprecated. 
Font Courier tag.


fontArial

private static final byte[] fontArial
Deprecated. 
Font Arial tag.


fontSymbol

private static final byte[] fontSymbol
Deprecated. 
Font Symbol tag.


fontTimesNewRoman

private static final byte[] fontTimesNewRoman
Deprecated. 
Font Times New Roman tag.


fontWindings

private static final byte[] fontWindings
Deprecated. 
Font Windings tag.


defaultFont

private static final byte[] defaultFont
Deprecated. 
Default Font.


firstIndent

private static final byte[] firstIndent
Deprecated. 
First indent tag.


listIndent

private static final byte[] listIndent
Deprecated. 
Left indent tag.


rightIndent

private static final byte[] rightIndent
Deprecated. 
Right indent tag.


sectionDefaults

private static final byte[] sectionDefaults
Deprecated. 
Reset section defaults tag.


section

private static final byte[] section
Deprecated. 
Begin new section tag.


paragraphDefaults

public static final byte[] paragraphDefaults
Deprecated. 
Reset paragraph defaults tag.


paragraph

public static final byte[] paragraph
Deprecated. 
Begin new paragraph tag.


sectionPageWidth

public static final byte[] sectionPageWidth
Deprecated. 
Page width of a section.


sectionPageHeight

public static final byte[] sectionPageHeight
Deprecated. 
Page height of a section.


listtableGroup

private static final byte[] listtableGroup
Deprecated. 
Begin the List Table


listoverridetableGroup

private static final byte[] listoverridetableGroup
Deprecated. 
Begin the List Override Table


listDefinition

private static final byte[] listDefinition
Deprecated. 
Begin a List definition


listTemplateID

private static final byte[] listTemplateID
Deprecated. 
List Template ID


hybridList

private static final byte[] hybridList
Deprecated. 
RTF Writer outputs hybrid lists


listLevelDefinition

private static final byte[] listLevelDefinition
Deprecated. 
Current List level


listLevelTypeOld

private static final byte[] listLevelTypeOld
Deprecated. 
Level numbering (old)


listLevelTypeNew

private static final byte[] listLevelTypeNew
Deprecated. 
Level numbering (new)


listLevelAlignOld

private static final byte[] listLevelAlignOld
Deprecated. 
Level alignment (old)


listLevelAlignNew

private static final byte[] listLevelAlignNew
Deprecated. 
Level alignment (new)


listLevelStartAt

private static final byte[] listLevelStartAt
Deprecated. 
Level starting number


listLevelTextDefinition

private static final byte[] listLevelTextDefinition
Deprecated. 
Level text group


listLevelTextLength

private static final byte[] listLevelTextLength
Deprecated. 
Filler for Level Text Length


listLevelTextStyleNumbers

private static final byte[] listLevelTextStyleNumbers
Deprecated. 
Level Text Numbering Style


listLevelTextStyleBullet

private static final byte[] listLevelTextStyleBullet
Deprecated. 
Level Text Bullet Style


listLevelNumbersDefinition

private static final byte[] listLevelNumbersDefinition
Deprecated. 
Level Numbers Definition


listLevelNumbers

private static final byte[] listLevelNumbers
Deprecated. 
Filler for Level Numbers


tabStop

private static final byte[] tabStop
Deprecated. 
Tab Stop


listBegin

private static final byte[] listBegin
Deprecated. 
Actual list begin


listCurrentLevel

private static final byte[] listCurrentLevel
Deprecated. 
Current list level


listTextOld

private static final byte[] listTextOld
Deprecated. 
List text group for older browsers


tab

private static final byte[] tab
Deprecated. 
Tab


listBulletOld

private static final byte[] listBulletOld
Deprecated. 
Old Bullet Style


listID

private static final byte[] listID
Deprecated. 
Current List ID


listOverride

private static final byte[] listOverride
Deprecated. 
List override


listOverrideCount

private static final byte[] listOverrideCount
Deprecated. 
Number of overrides


bold

protected static final byte bold
Deprecated. 
Bold tag.

See Also:
Constant Field Values

italic

protected static final byte italic
Deprecated. 
Italic tag.

See Also:
Constant Field Values

underline

protected static final byte[] underline
Deprecated. 
Underline tag.


strikethrough

protected static final byte[] strikethrough
Deprecated. 
Strikethrough tag.


alignLeft

public static final byte[] alignLeft
Deprecated. 
Text alignment left tag.


alignCenter

public static final byte[] alignCenter
Deprecated. 
Text alignment center tag.


alignRight

public static final byte[] alignRight
Deprecated. 
Text alignment right tag.


alignJustify

public static final byte[] alignJustify
Deprecated. 
Text alignment justify tag.


colorTable

private static final byte[] colorTable
Deprecated. 
Begin colour table tag.


colorRed

private static final byte[] colorRed
Deprecated. 
Red value tag.


colorGreen

private static final byte[] colorGreen
Deprecated. 
Green value tag.


colorBlue

private static final byte[] colorBlue
Deprecated. 
Blue value tag.


infoBegin

private static final byte[] infoBegin
Deprecated. 
Begin the info group tag.


metaAuthor

private static final byte[] metaAuthor
Deprecated. 
Author tag.


metaSubject

private static final byte[] metaSubject
Deprecated. 
Subject tag.


metaKeywords

private static final byte[] metaKeywords
Deprecated. 
Keywords tag.


metaTitle

private static final byte[] metaTitle
Deprecated. 
Title tag.


metaProducer

private static final byte[] metaProducer
Deprecated. 
Producer tag.


metaCreationDate

private static final byte[] metaCreationDate
Deprecated. 
Creation Date tag.


year

private static final byte[] year
Deprecated. 
Year tag.


month

private static final byte[] month
Deprecated. 
Month tag.


day

private static final byte[] day
Deprecated. 
Day tag.


hour

private static final byte[] hour
Deprecated. 
Hour tag.


minute

private static final byte[] minute
Deprecated. 
Minute tag.


second

private static final byte[] second
Deprecated. 
Second tag.


startSuper

private static final byte[] startSuper
Deprecated. 
Start superscript.


startSub

private static final byte[] startSub
Deprecated. 
Start subscript.


endSuperSub

private static final byte[] endSuperSub
Deprecated. 
End super/sub script.


titlePage

private static final byte[] titlePage
Deprecated. 
Title Page tag


facingPages

private static final byte[] facingPages
Deprecated. 
Facing pages tag


headerBegin

private static final byte[] headerBegin
Deprecated. 
Begin header group tag.


footerBegin

private static final byte[] footerBegin
Deprecated. 
Begin footer group tag.


headerlBegin

private static final byte[] headerlBegin
Deprecated. 

footerlBegin

private static final byte[] footerlBegin
Deprecated. 

headerrBegin

private static final byte[] headerrBegin
Deprecated. 

footerrBegin

private static final byte[] footerrBegin
Deprecated. 

headerfBegin

private static final byte[] headerfBegin
Deprecated. 

footerfBegin

private static final byte[] footerfBegin
Deprecated. 

rtfPaperWidth

private static final byte[] rtfPaperWidth
Deprecated. 
Paper width tag.


rtfPaperHeight

private static final byte[] rtfPaperHeight
Deprecated. 
Paper height tag.


rtfMarginLeft

private static final byte[] rtfMarginLeft
Deprecated. 
Margin left tag.


rtfMarginRight

private static final byte[] rtfMarginRight
Deprecated. 
Margin right tag.


rtfMarginTop

private static final byte[] rtfMarginTop
Deprecated. 
Margin top tag.


rtfMarginBottom

private static final byte[] rtfMarginBottom
Deprecated. 
Margin bottom tag.


newPage

private static final byte[] newPage
Deprecated. 
New Page tag.


landscapeTag1

private static final byte[] landscapeTag1
Deprecated. 
Document Landscape tag 1.


landscapeTag2

private static final byte[] landscapeTag2
Deprecated. 
Document Landscape tag 2.


annotationID

private static final byte[] annotationID
Deprecated. 
Annotation ID tag.


annotationAuthor

private static final byte[] annotationAuthor
Deprecated. 
Annotation Author tag.


annotation

private static final byte[] annotation
Deprecated. 
Annotation text tag.


pictureGroup

private static final byte[] pictureGroup
Deprecated. 
Begin the main Picture group tag


picture

private static final byte[] picture
Deprecated. 
Begin the picture tag


picturePNG

private static final byte[] picturePNG
Deprecated. 
PNG Image


pictureJPEG

private static final byte[] pictureJPEG
Deprecated. 
JPEG Image


pictureBMP

private static final byte[] pictureBMP
Deprecated. 
BMP Image


pictureWMF

private static final byte[] pictureWMF
Deprecated. 
WMF Image


pictureWidth

private static final byte[] pictureWidth
Deprecated. 
Picture width


pictureHeight

private static final byte[] pictureHeight
Deprecated. 
Picture height


pictureScaleX

private static final byte[] pictureScaleX
Deprecated. 
Picture scale horizontal percent


pictureScaleY

private static final byte[] pictureScaleY
Deprecated. 
Picture scale vertical percent


field

protected static final byte[] field
Deprecated. 
Begin field tag


fieldContent

protected static final byte[] fieldContent
Deprecated. 
Content fo the field


fieldPage

protected static final byte[] fieldPage
Deprecated. 
PAGE numbers


fieldHyperlink

protected static final byte[] fieldHyperlink
Deprecated. 
HYPERLINK field


fieldDisplay

protected static final byte[] fieldDisplay
Deprecated. 
Last page number (not used)


fontList

private ArrayList fontList
Deprecated. 
This ArrayList contains all fonts used in the document.


colorList

private ArrayList colorList
Deprecated. 
This ArrayList contains all colours used in the document.


content

private ByteArrayOutputStream content
Deprecated. 
This ByteArrayOutputStream contains the main body of the document.


info

private ByteArrayOutputStream info
Deprecated. 
This ByteArrayOutputStream contains the information group.


listtable

private ByteArrayOutputStream listtable
Deprecated. 
This ByteArrayOutputStream contains the list table.


listoverride

private ByteArrayOutputStream listoverride
Deprecated. 
This ByteArrayOutputStream contains the list override table.


header

private HeaderFooter header
Deprecated. 
Document header.


footer

private HeaderFooter footer
Deprecated. 
Document footer.


marginLeft

private int marginLeft
Deprecated. 
Left margin.


marginRight

private int marginRight
Deprecated. 
Right margin.


marginTop

private int marginTop
Deprecated. 
Top margin.


marginBottom

private int marginBottom
Deprecated. 
Bottom margin.


pageWidth

private int pageWidth
Deprecated. 
Page width.


pageHeight

private int pageHeight
Deprecated. 
Page height.


TWIPSFACTOR

public static final double TWIPSFACTOR
Deprecated. 
Factor to use when converting.

See Also:
Constant Field Values

currentListID

private int currentListID
Deprecated. 
Current list ID.


listIds

private ArrayList listIds
Deprecated. 
List of current Lists.


listLevel

private int listLevel
Deprecated. 
Current List Level.


maxListLevel

private int maxListLevel
Deprecated. 
Current maximum List Level.


writeTOC

private boolean writeTOC
Deprecated. 
Write a TOC


hasTitlePage

private boolean hasTitlePage
Deprecated. 
Special title page


inHeaderFooter

private boolean inHeaderFooter
Deprecated. 
Currently writing either Header or Footer


inTable

private boolean inTable
Deprecated. 
Currently writing a Table


landscape

private boolean landscape
Deprecated. 
Landscape or Portrait Document

Constructor Detail

RtfWriter

protected RtfWriter(Document doc,
                    OutputStream os)
Deprecated. 
Constructs a RtfWriter.

Parameters:
doc - The Document that is to be written as RTF
os - The OutputStream the writer has to write to.
Method Detail

setGenerateTOCEntries

public void setGenerateTOCEntries(boolean writeTOC)
Deprecated. 
This method controls whether TOC entries are automatically generated

Parameters:
writeTOC - boolean value indicating whether a TOC is to be generated

getGeneratingTOCEntries

public boolean getGeneratingTOCEntries()
Deprecated. 
Gets the current setting of writeTOC

Returns:
boolean value indicating whether a TOC is being generated

setHasTitlePage

public void setHasTitlePage(boolean hasTitlePage)
Deprecated. 
This method controls whether the first page is a title page

Parameters:
hasTitlePage - boolean value indicating whether the first page is a title page

getHasTitlePage

public boolean getHasTitlePage()
Deprecated. 
Gets the current setting of hasTitlePage

Returns:
boolean value indicating whether the first page is a title page

setLandscape

public void setLandscape(boolean landscape)
Deprecated. 
Explicitly sets the page format to use. Otherwise the RtfWriter will try to guess the format by comparing pagewidth and pageheight

Parameters:
landscape - boolean value indicating whether we are using landscape format or not

getLandscape

public boolean getLandscape()
Deprecated. 
Returns the current landscape setting

Returns:
boolean value indicating the current page format

getInstance

public static RtfWriter getInstance(Document document,
                                    OutputStream os)
Deprecated. 
Gets an instance of the RtfWriter.

Parameters:
document - The Document that has to be written
os - The OutputStream the writer has to write to.
Returns:
a new RtfWriter

open

public void open()
Deprecated. 
Signals that the Document has been opened and that Elements can be added.

Specified by:
open in interface DocListener
Overrides:
open in class DocWriter

close

public void close()
Deprecated. 
Signals that the Document was closed and that no other Elements will be added.

The content of the font table, color table, information group, content, header, footer are merged into the final OutputStream

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

setFooter

public void setFooter(HeaderFooter footer)
Deprecated. 
Adds the footer to the bottom of the Document.

Specified by:
setFooter in interface DocListener
Overrides:
setFooter in class DocWriter
Parameters:
footer -

setHeader

public void setHeader(HeaderFooter header)
Deprecated. 
Adds the header to the top of the Document.

Specified by:
setHeader in interface DocListener
Overrides:
setHeader in class DocWriter
Parameters:
header -

resetFooter

public void resetFooter()
Deprecated. 
Resets the footer.

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

resetHeader

public void resetHeader()
Deprecated. 
Resets the header.

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

newPage

public boolean newPage()
                throws DocumentException
Deprecated. 
Tells the RtfWriter that a new page is to be begun.

Specified by:
newPage in interface DocListener
Overrides:
newPage in class DocWriter
Returns:
true if a new Page was begun.
Throws:
DocumentException - if the Document was not open or had been closed.

setMargins

public boolean setMargins(float marginLeft,
                          float marginRight,
                          float marginTop,
                          float marginBottom)
Deprecated. 
Sets the page margins

Specified by:
setMargins in interface DocListener
Overrides:
setMargins in class DocWriter
Parameters:
marginLeft - The left margin
marginRight - The right margin
marginTop - The top margin
marginBottom - The bottom margin
Returns:
true if the page margins were set.

setPageSize

public boolean setPageSize(Rectangle pageSize)
Deprecated. 
Sets the page size

Specified by:
setPageSize in interface DocListener
Overrides:
setPageSize in class DocWriter
Parameters:
pageSize - A Rectangle specifying the page size
Returns:
true if the page size was set

writeTOC

public boolean writeTOC(String tocTitle,
                        Font titleFont,
                        boolean showTOCasEntry,
                        Font showTOCEntryFont)
Deprecated. 
Write the table of contents.

Parameters:
tocTitle - The title that will be displayed above the TOC
titleFont - The Font that will be used for the tocTitle
showTOCasEntry - Set this to true if you want the TOC to appear as an entry in the TOC
showTOCEntryFont - Use this Font to specify what Font to use when showTOCasEntry is true
Returns:
true if the TOC was added.

add

public boolean add(Element element)
            throws DocumentException
Deprecated. 
Signals that an Element was added to the Document.

Specified by:
add in interface ElementListener
Overrides:
add in class DocWriter
Parameters:
element - A high level object to add
Returns:
true if the element was added, false if not.
Throws:
DocumentException - if a document isn't open yet, or has been closed

addElement

protected boolean addElement(Element element,
                             ByteArrayOutputStream out)
                      throws DocumentException
Deprecated. 
Adds an Element to the Document.

Parameters:
element - the high level element to add
out - the outputstream to which the RTF data is sent
Returns:
true if the element was added, false if not.
Throws:
DocumentException - if a document isn't open yet, or has been closed

writeSection

private void writeSection(Section sectionElement,
                          ByteArrayOutputStream out)
                   throws IOException,
                          DocumentException
Deprecated. 
Write the beginning of a new Section

Parameters:
sectionElement - The Section be written
out - The ByteArrayOutputStream to write to
Throws:
IOException
DocumentException

writeParagraph

private void writeParagraph(Paragraph paragraphElement,
                            ByteArrayOutputStream out)
                     throws IOException
Deprecated. 
Write the beginning of a new Paragraph

Parameters:
paragraphElement - The Paragraph to be written
out - The ByteArrayOutputStream to write to
Throws:
IOException

writePhrase

private void writePhrase(Phrase phrase,
                         ByteArrayOutputStream out)
                  throws IOException
Deprecated. 
Write a Phrase.

Parameters:
phrase - The Phrase item to be written
out - The ByteArrayOutputStream to write to
Throws:
IOException

writeAnchor

private void writeAnchor(Anchor anchor,
                         ByteArrayOutputStream out)
                  throws IOException
Deprecated. 
Write an Anchor. Anchors are treated like Phrases.

Parameters:
anchor - The Chunk item to be written
out - The ByteArrayOutputStream to write to
Throws:
IOException

writeChunk

private void writeChunk(Chunk chunk,
                        ByteArrayOutputStream out)
                 throws IOException,
                        DocumentException
Deprecated. 
Write a Chunk and all its font properties.

Parameters:
chunk - The Chunk item to be written
out - The ByteArrayOutputStream to write to
Throws:
IOException
DocumentException

writeInitialFontSignature

protected void writeInitialFontSignature(OutputStream out,
                                         Chunk chunk)
                                  throws IOException
Deprecated. 
Throws:
IOException

writeFinishingFontSignature

protected void writeFinishingFontSignature(OutputStream out,
                                           Chunk chunk)
                                    throws IOException
Deprecated. 
Throws:
IOException

writeListElement

private void writeListElement(ListItem listItem,
                              ByteArrayOutputStream out)
                       throws IOException,
                              DocumentException
Deprecated. 
Write a ListItem

Parameters:
listItem - The ListItem to be written
out - The ByteArrayOutputStream to write to
Throws:
IOException
DocumentException

writeList

private void writeList(List list,
                       ByteArrayOutputStream out)
                throws IOException,
                       DocumentException
Deprecated. 
Write a List

Parameters:
list - The List to be written
out - The ByteArrayOutputStream to write to
Throws:
IOException
DocumentException

writeTable

private void writeTable(Table table,
                        ByteArrayOutputStream out)
                 throws IOException,
                        DocumentException
Deprecated. 
Write a Table.

Parameters:
table - The table to be written
out - The ByteArrayOutputStream to write to Currently no nesting of tables is supported. If a cell contains anything but a Cell Object it is ignored.
Throws:
IOException
DocumentException

writeImage

private void writeImage(Image image,
                        ByteArrayOutputStream out)
                 throws IOException,
                        DocumentException
Deprecated. 
Write an Image.

Parameters:
image - The image to be written
out - The ByteArrayOutputStream to write to At the moment only PNG and JPEG Images are supported.
Throws:
IOException
DocumentException

writeAnnotation

private void writeAnnotation(Annotation annotationElement,
                             ByteArrayOutputStream out)
                      throws IOException
Deprecated. 
Write an Annotation

Parameters:
annotationElement - The Annotation to be written
out - The ByteArrayOutputStream to write to
Throws:
IOException

writeMeta

private void writeMeta(byte[] metaName,
                       Meta meta)
                throws IOException
Deprecated. 
Add a Meta element. It is written to the Inforamtion Group and merged with the main ByteArrayOutputStream when the Document is closed.

Parameters:
metaName - The type of Meta element to be added
meta - The Meta element to be added Currently only the Meta Elements Author, Subject, Keywords, Title, Producer and CreationDate are supported.
Throws:
IOException

writeFormatedDateTime

private void writeFormatedDateTime(String date)
                            throws IOException
Deprecated. 
Writes a date. The date is formated Year, Month, Day, Hour, Minute, Second

Parameters:
date - The date to be written
Throws:
IOException

addFont

protected int addFont(Font newFont)
Deprecated. 
Add a new Font to the list of fonts. If the Font already exists in the list of fonts, then it is not added again.

Parameters:
newFont - The Font to be added
Returns:
The index of the Font in the font list

addColor

protected int addColor(Color newColor)
Deprecated. 
Add a new Color to the list of colours. If the Color already exists in the list of colours, then it is not added again.

Parameters:
newColor - The Color to be added
Returns:
The index of the color in the colour list

writeDocument

private boolean writeDocument()
Deprecated. 
Merge all the different ArrayLists and ByteArrayOutputStreams to the final ByteArrayOutputStream

Returns:
true if all information was sucessfully written to the ByteArrayOutputStream

writeDocumentIntro

private void writeDocumentIntro()
                         throws IOException
Deprecated. 
Write the Rich Text file settings

Throws:
IOException

writeFontList

private void writeFontList()
                    throws IOException
Deprecated. 
Write the font list to the final ByteArrayOutputStream

Throws:
IOException

writeColorList

private void writeColorList()
                     throws IOException
Deprecated. 
Write the colour list to the final ByteArrayOutputStream

Throws:
IOException

writeInfoGroup

private void writeInfoGroup()
                     throws IOException
Deprecated. 
Write the Information Group to the final ByteArrayOutputStream

Throws:
IOException

writeList

private void writeList()
                throws IOException
Deprecated. 
Write the listtable and listoverridetable to the final ByteArrayOutputStream

Throws:
IOException

writeInt

public static final void writeInt(OutputStream out,
                                  int i)
                           throws IOException
Deprecated. 
Write an integer

Parameters:
out - The OuputStream to which the int value is to be written
i - The int value to be written
Throws:
IOException

getRandomInt

private int getRandomInt()
Deprecated. 
Get a random integer. This returns a unique random integer to be used with listids.

Returns:
Random int value.

writeHeadersFooters

public void writeHeadersFooters(ByteArrayOutputStream os)
                         throws IOException
Deprecated. 
Write the current header and footer to a ByteArrayOutputStream

Parameters:
os - The ByteArrayOutputStream to which the header and footer will be written.
Throws:
IOException

writeHeaderFooter

private void writeHeaderFooter(HeaderFooter headerFooter,
                               byte[] hfType,
                               ByteArrayOutputStream target)
                        throws IOException
Deprecated. 
Write a HeaderFooter to a ByteArrayOutputStream

Parameters:
headerFooter - The HeaderFooter object to be written.
hfType - The type of header or footer to be added.
target - The ByteArrayOutputStream to which the HeaderFooter will be written.
Throws:
IOException

writeDocumentFormat

private void writeDocumentFormat()
                          throws IOException
Deprecated. 
Write the Document's Paper and Margin Size to the final ByteArrayOutputStream

Throws:
IOException

initDefaults

private void initDefaults()
Deprecated. 
Initialise all helper classes. Clears alls lists, creates new ByteArrayOutputStream's


writeSectionDefaults

private void writeSectionDefaults(ByteArrayOutputStream out)
                           throws IOException
Deprecated. 
Writes the default values for the current Section

Parameters:
out - The ByteArrayOutputStream to be written to
Throws:
IOException

parseFormat

private boolean parseFormat(Rectangle pageSize,
                            boolean rotate)
Deprecated. 
This method tries to fit the Rectangle pageSize to one of the predefined PageSize rectangles. If a match is found the pageWidth and pageHeight will be set according to values determined from files generated by MS Word2000 and OpenOffice 641. If no match is found the method will try to match the rotated Rectangle by calling itself with the parameter rotate set to true.

Parameters:
pageSize - a rectangle defining the size of the page
rotate - portrait or lanscape?
Returns:
true if the format parsing succeeded

rectEquals

private boolean rectEquals(Rectangle rect1,
                           Rectangle rect2)
Deprecated. 
This method compares to Rectangles. They are considered equal if width and height are the same

Parameters:
rect1 -
rect2 -
Returns:
true if rect1 and rect2 represent the same rectangle

writingHeaderFooter

public boolean writingHeaderFooter()
Deprecated. 
Returns whether we are currently writing a header or footer

Returns:
the value of inHeaderFooter

filterSpecialChar

public static final String filterSpecialChar(String str,
                                             boolean useHex)
Deprecated. 
Replaces special characters with their unicode values

Parameters:
str - The original String
useHex -
Returns:
The converted String

addHeaderFooterFontColor

private void addHeaderFooterFontColor(HeaderFooter hf)
Deprecated. 

processHeaderFooter

private void processHeaderFooter(HeaderFooter hf)
Deprecated. 

setMarginMirroring

public boolean setMarginMirroring(boolean MarginMirroring)
Deprecated. 
Description copied from interface: DocListener
Parameter that allows you to do margin mirroring (odd/even pages)

Specified by:
setMarginMirroring in interface DocListener
Overrides:
setMarginMirroring in class DocWriter
Returns:
true if succesfull
See Also:
DocListener.setMarginMirroring(boolean)