Package com.lowagie.text.rtf.document
Class RtfDocument
- java.lang.Object
-
- com.lowagie.text.rtf.RtfElement
-
- com.lowagie.text.rtf.document.RtfDocument
-
- All Implemented Interfaces:
RtfBasicElement,com.lowagie.text.RtfElementInterface
public class RtfDocument extends RtfElement
The RtfDocument stores all document related data and also the main data stream. INTERNAL CLASS - NOT TO BE USED DIRECTLY- Since:
- 1.x
- Version:
- $Id: RtfDocument.java 4065 2009-09-16 23:09:11Z psoares33 $
- Author:
- Mark Hall (Mark.Hall@mail.room3b.eu), Todd Bush [Tab support], Thomas Bickel (tmb99@inode.at)
-
-
Field Summary
-
Fields inherited from class com.lowagie.text.rtf.RtfElement
document, inHeader, inTable
-
Fields inherited from interface com.lowagie.text.rtf.RtfBasicElement
CLOSE_GROUP, COMMA_DELIMITER, DELIMITER, OPEN_GROUP, TWIPS_FACTOR
-
-
Constructor Summary
Constructors Constructor Description RtfDocument()The default constructor for a RtfDocument
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(RtfBasicElement element)Adds an element to the rtf documentvoidfilterSpecialChar(java.io.OutputStream out, java.lang.String str, boolean useHex, boolean softLineBreaks)Writes the given string to the givenOutputStreamencoding the string characters.booleangetAutogenerateTOCEntries()Get whether to automatically generate table of contents entriesRtfDocumentHeadergetDocumentHeader()Gets the RtfDocumentHeader of this RtfDocumentRtfDocumentSettingsgetDocumentSettings()Gets the RtfDocumentSettings that specify how the rtf document is generated.RtfBasicElementgetLastElementWritten()Gets the last RtfBasicElement that was directly added to the RtfDocument.RtfMappergetMapper()Gets the RtfMapper object of this RtfDocumentintgetRandomInt()Generates a random integer that is unique with respect to the document.voidopen()Opens the RtfDocument and initializes the data cache.voidoutputDebugLinebreak(java.io.OutputStream result)Helper method outputs linebreak in document if debugging is turned on.voidsetAutogenerateTOCEntries(boolean autogenerate)Whether to automagically generate table of contents entries when adding Chapters or Sections.voidwriteContent(java.io.OutputStream out)unusedvoidwriteDocument(java.io.OutputStream out)Writes the document-
Methods inherited from class com.lowagie.text.rtf.RtfElement
intToByteArray, isInTable, setInHeader, setInTable, setRtfDocument
-
-
-
-
Method Detail
-
writeContent
public void writeContent(java.io.OutputStream out) throws java.io.IOExceptionunused- Specified by:
writeContentin interfaceRtfBasicElement- Specified by:
writeContentin classRtfElement- Parameters:
out- TheOutputStreamto write the content to- Throws:
java.io.IOException
-
writeDocument
public void writeDocument(java.io.OutputStream out)
Writes the document- Parameters:
out- TheOutputStreamto write the RTF document to.
-
open
public void open()
Opens the RtfDocument and initializes the data cache. If the data cache is set to CACHE_DISK, but the cache cannot be initialized then the memory cache is used.
-
add
public void add(RtfBasicElement element)
Adds an element to the rtf document- Parameters:
element- The element to add
-
getMapper
public RtfMapper getMapper()
Gets the RtfMapper object of this RtfDocument- Returns:
- The RtfMapper
-
getRandomInt
public int getRandomInt()
Generates a random integer that is unique with respect to the document. Will not return a number between -1 and -5 because some values in that range are invalid.- Returns:
- A random int
-
getDocumentHeader
public RtfDocumentHeader getDocumentHeader()
Gets the RtfDocumentHeader of this RtfDocument- Returns:
- The RtfDocumentHeader of this RtfDocument
-
filterSpecialChar
public void filterSpecialChar(java.io.OutputStream out, java.lang.String str, boolean useHex, boolean softLineBreaks) throws java.io.IOExceptionWrites the given string to the givenOutputStreamencoding the string characters.- Parameters:
out- destination OutputStreamstr- string to writeuseHex- iftruehex encoding characters is preferred to unicode encoding if possiblesoftLineBreaks- iftruereturn characters are written as soft line breaks- Throws:
java.io.IOException
-
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
-
getAutogenerateTOCEntries
public boolean getAutogenerateTOCEntries()
Get whether to automatically generate table of contents entries- Returns:
- Whether to automatically generate TOC entries
-
getDocumentSettings
public RtfDocumentSettings getDocumentSettings()
Gets the RtfDocumentSettings that specify how the rtf document is generated.- Returns:
- The current RtfDocumentSettings.
-
getLastElementWritten
public RtfBasicElement getLastElementWritten()
Gets the last RtfBasicElement that was directly added to the RtfDocument.- Returns:
- The last RtfBasicElement that was directly added to the RtfDocument.
-
outputDebugLinebreak
public final void outputDebugLinebreak(java.io.OutputStream result) throws java.io.IOExceptionHelper method outputs linebreak in document if debugging is turned on.- Parameters:
result- the OutputStream to write the linebreak to.- Throws:
java.io.IOException- Since:
- 2.1.3
-
-