|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.lowagie.text.DocWriter
com.lowagie.text.rtf.RtfWriter
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:
Field Summary | |
static byte[] |
alignCenter
Text alignment center tag. |
static byte[] |
alignJustify
Text alignment justify tag. |
static byte[] |
alignLeft
Text alignment left tag. |
static byte[] |
alignRight
Text alignment right tag. |
private static byte[] |
annotation
Annotation text tag. |
private static byte[] |
annotationAuthor
Annotation Author tag. |
private static byte[] |
annotationID
Annotation ID tag. |
private static byte[] |
ansi
RTF encoding. |
private static byte[] |
ansiCodepage
RTF encoding codepage. |
protected static byte |
bold
Bold tag. |
static byte |
closeGroup
This is the character for closing a group. |
private static byte[] |
colorBlue
Blue value tag. |
private static byte[] |
colorGreen
Green value tag. |
private ArrayList |
colorList
This ArrayList contains all colours used in the document. |
private static byte[] |
colorRed
Red value tag. |
private static byte[] |
colorTable
Begin colour table tag. |
private static byte |
commaDelimiter
This is another delimiter between RTF tags and normal text. |
private ByteArrayOutputStream |
content
This ByteArrayOutputStream contains the main body of the document. |
private int |
currentListID
Current list ID. |
private static byte[] |
day
Day tag. |
private static byte[] |
defaultFont
Default Font. |
protected static byte |
delimiter
This is the delimiter between RTF tags and normal text. |
private static byte[] |
docBegin
RTF begin and version. |
private static byte[] |
endSuperSub
End super/sub script. |
static byte |
escape
This is the escape character which introduces RTF tags. |
private static byte[] |
extendedEscape
This is another escape character which introduces RTF tags. |
private static byte[] |
facingPages
Facing pages tag |
protected static byte[] |
field
Begin field tag |
protected static byte[] |
fieldContent
Content fo the field |
protected static byte[] |
fieldDisplay
Last page number (not used) |
protected static byte[] |
fieldHyperlink
HYPERLINK field |
protected static byte[] |
fieldPage
PAGE numbers |
private static byte[] |
firstIndent
First indent tag. |
private static byte[] |
fontArial
Font Arial tag. |
private static byte[] |
fontCharset
Font charset tag. |
protected static byte[] |
fontColor
Font color tag. |
private static byte[] |
fontCourier
Font Courier tag. |
private ArrayList |
fontList
This ArrayList contains all fonts used in the document. |
private static byte[] |
fontModern
Modern font tag. |
protected static byte |
fontNumber
Font number tag. |
private static byte[] |
fontRoman
Roman font tag. |
protected static byte[] |
fontSize
Font size tag. |
private static byte[] |
fontSwiss
Swiss font tag. |
private static byte[] |
fontSymbol
Font Symbol tag. |
private static byte[] |
fontTable
Begin the font table tag. |
private static byte[] |
fontTech
Tech font tag. |
private static byte[] |
fontTimesNewRoman
Font Times New Roman tag. |
private static byte[] |
fontWindings
Font Windings tag. |
private HeaderFooter |
footer
Document footer. |
private static byte[] |
footerBegin
Begin footer group tag. |
private static byte[] |
footerfBegin
|
private static byte[] |
footerlBegin
|
private static byte[] |
footerrBegin
|
private boolean |
hasTitlePage
Special title page |
private HeaderFooter |
header
Document header. |
private static byte[] |
headerBegin
Begin header group tag. |
private static byte[] |
headerfBegin
|
private static byte[] |
headerlBegin
|
private static byte[] |
headerrBegin
|
private static byte[] |
hour
Hour tag. |
private static byte[] |
hybridList
RTF Writer outputs hybrid lists |
private ByteArrayOutputStream |
info
This ByteArrayOutputStream contains the information group. |
private static byte[] |
infoBegin
Begin the info group tag. |
private boolean |
inHeaderFooter
Currently writing either Header or Footer |
private boolean |
inTable
Currently writing a Table |
protected static byte |
italic
Italic tag. |
private boolean |
landscape
Landscape or Portrait Document |
private static byte[] |
landscapeTag1
Document Landscape tag 1. |
private static byte[] |
landscapeTag2
Document Landscape tag 2. |
private static byte[] |
listBegin
Actual list begin |
private static byte[] |
listBulletOld
Old Bullet Style |
private static byte[] |
listCurrentLevel
Current list level |
private static byte[] |
listDefinition
Begin a List definition |
private static byte[] |
listID
Current List ID |
private ArrayList |
listIds
List of current Lists. |
private static byte[] |
listIndent
Left indent tag. |
private int |
listLevel
Current List Level. |
private static byte[] |
listLevelAlignNew
Level alignment (new) |
private static byte[] |
listLevelAlignOld
Level alignment (old) |
private static byte[] |
listLevelDefinition
Current List level |
private static byte[] |
listLevelNumbers
Filler for Level Numbers |
private static byte[] |
listLevelNumbersDefinition
Level Numbers Definition |
private static byte[] |
listLevelStartAt
Level starting number |
private static byte[] |
listLevelTextDefinition
Level text group |
private static byte[] |
listLevelTextLength
Filler for Level Text Length |
private static byte[] |
listLevelTextStyleBullet
Level Text Bullet Style |
private static byte[] |
listLevelTextStyleNumbers
Level Text Numbering Style |
private static byte[] |
listLevelTypeNew
Level numbering (new) |
private static byte[] |
listLevelTypeOld
Level numbering (old) |
private ByteArrayOutputStream |
listoverride
This ByteArrayOutputStream contains the list override table. |
private static byte[] |
listOverride
List override |
private static byte[] |
listOverrideCount
Number of overrides |
private static byte[] |
listoverridetableGroup
Begin the List Override Table |
private ByteArrayOutputStream |
listtable
This ByteArrayOutputStream contains the list table. |
private static byte[] |
listtableGroup
Begin the List Table |
private static byte[] |
listTemplateID
List Template ID |
private static byte[] |
listTextOld
List text group for older browsers |
private int |
marginBottom
Bottom margin. |
private int |
marginLeft
Left margin. |
private int |
marginRight
Right margin. |
private int |
marginTop
Top margin. |
private int |
maxListLevel
Current maximum List Level. |
private static byte[] |
metaAuthor
Author tag. |
private static byte[] |
metaCreationDate
Creation Date tag. |
private static byte[] |
metaKeywords
Keywords tag. |
private static byte[] |
metaProducer
Producer tag. |
private static byte[] |
metaSubject
Subject tag. |
private static byte[] |
metaTitle
Title tag. |
private static byte[] |
minute
Minute tag. |
private static byte[] |
month
Month tag. |
private static byte[] |
newPage
New Page tag. |
static byte |
openGroup
This is the character for beginning a new group. |
private int |
pageHeight
Page height. |
private int |
pageWidth
Page width. |
static byte[] |
paragraph
Begin new paragraph tag. |
static byte[] |
paragraphDefaults
Reset paragraph defaults tag. |
private static byte[] |
picture
Begin the picture tag |
private static byte[] |
pictureBMP
BMP Image |
private static byte[] |
pictureGroup
Begin the main Picture group tag |
private static byte[] |
pictureHeight
Picture height |
private static byte[] |
pictureJPEG
JPEG Image |
private static byte[] |
picturePNG
PNG Image |
private static byte[] |
pictureScaleX
Picture scale horizontal percent |
private static byte[] |
pictureScaleY
Picture scale vertical percent |
private static byte[] |
pictureWidth
Picture width |
private static byte[] |
pictureWMF
WMF Image |
private static byte[] |
rightIndent
Right indent tag. |
private static byte[] |
rtfMarginBottom
Margin bottom tag. |
private static byte[] |
rtfMarginLeft
Margin left tag. |
private static byte[] |
rtfMarginRight
Margin right tag. |
private static byte[] |
rtfMarginTop
Margin top tag. |
private static byte[] |
rtfPaperHeight
Paper height tag. |
private static byte[] |
rtfPaperWidth
Paper width tag. |
private static byte[] |
second
Second tag. |
private static byte[] |
section
Begin new section tag. |
private static byte[] |
sectionDefaults
Reset section defaults tag. |
static byte[] |
sectionPageHeight
Page height of a section. |
static byte[] |
sectionPageWidth
Page width of a section. |
private static byte[] |
startSub
Start subscript. |
private static byte[] |
startSuper
Start superscript. |
protected static byte[] |
strikethrough
Strikethrough tag. |
private static byte[] |
tab
Tab |
private static byte[] |
tabStop
Tab Stop |
private static byte[] |
titlePage
Title Page tag |
static double |
TWIPSFACTOR
Factor to use when converting. |
protected static byte[] |
underline
Underline tag. |
private boolean |
writeTOC
Write a TOC |
private static byte[] |
year
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)
Constructs a RtfWriter . |
Method Summary | |
boolean |
add(Element element)
Signals that an Element was added to the Document . |
protected int |
addColor(Color newColor)
Add a new Color to the list of colours. |
protected boolean |
addElement(Element element,
ByteArrayOutputStream out)
Adds an Element to the Document . |
protected int |
addFont(Font newFont)
Add a new Font to the list of fonts. |
private void |
addHeaderFooterFontColor(HeaderFooter hf)
|
void |
close()
Signals that the Document was closed and that no other
Elements will be added.
|
static String |
filterSpecialChar(String str)
Replaces special characters with their unicode values |
boolean |
getGeneratingTOCEntries()
Gets the current setting of writeTOC |
boolean |
getHasTitlePage()
Gets the current setting of hasTitlePage |
static RtfWriter |
getInstance(Document document,
OutputStream os)
Gets an instance of the RtfWriter . |
boolean |
getLandscape()
Returns the current landscape setting |
private int |
getRandomInt()
Get a random integer. |
private void |
initDefaults()
Initialise all helper classes. |
boolean |
newPage()
Tells the RtfWriter that a new page is to be begun. |
void |
open()
Signals that the Document has been opened and that
Elements can be added. |
private boolean |
parseFormat(Rectangle pageSize,
boolean rotate)
This method tries to fit the Rectangle pageSize to one of the predefined PageSize rectangles.
|
private void |
processHeaderFooter(HeaderFooter hf)
|
private boolean |
rectEquals(Rectangle rect1,
Rectangle rect2)
This method compares to Rectangles. |
void |
resetFooter()
Resets the footer. |
void |
resetHeader()
Resets the header. |
void |
setFooter(HeaderFooter footer)
Adds the footer to the bottom of the Document . |
void |
setGenerateTOCEntries(boolean writeTOC)
This method controls whether TOC entries are automatically generated |
void |
setHasTitlePage(boolean hasTitlePage)
This method controls whether the first page is a title page |
void |
setHeader(HeaderFooter header)
Adds the header to the top of the Document . |
void |
setLandscape(boolean landscape)
Explicitly sets the page format to use. |
boolean |
setMargins(float marginLeft,
float marginRight,
float marginTop,
float marginBottom)
Sets the page margins |
boolean |
setPageSize(Rectangle pageSize)
Sets the page size |
private void |
writeAnchor(Anchor anchor,
ByteArrayOutputStream out)
Write an Anchor . |
private void |
writeAnnotation(Annotation annotationElement,
ByteArrayOutputStream out)
Write an Annotation |
private void |
writeChunk(Chunk chunk,
ByteArrayOutputStream out)
Write a Chunk and all its font properties. |
private void |
writeColorList()
Write the colour list to the final ByteArrayOutputStream |
private boolean |
writeDocument()
Merge all the different ArrayList s and ByteArrayOutputStream s
to the final ByteArrayOutputStream |
private void |
writeDocumentFormat()
Write the Document 's Paper and Margin Size
to the final ByteArrayOutputStream |
private void |
writeDocumentIntro()
Write the Rich Text file settings |
protected void |
writeFinishingFontSignature(OutputStream out,
Chunk chunk)
|
private void |
writeFontList()
Write the font list to the final ByteArrayOutputStream |
private void |
writeFormatedDateTime(String date)
Writes a date. |
private void |
writeHeaderFooter(HeaderFooter headerFooter,
byte[] hfType,
ByteArrayOutputStream target)
Write a HeaderFooter to a ByteArrayOutputStream |
void |
writeHeadersFooters(ByteArrayOutputStream os)
Write the current header and footer to a ByteArrayOutputStream |
private void |
writeImage(Image image,
ByteArrayOutputStream out)
Write an Image . |
private void |
writeInfoGroup()
Write the Information Group to the final ByteArrayOutputStream |
protected void |
writeInitialFontSignature(OutputStream out,
Chunk chunk)
|
static void |
writeInt(OutputStream out,
int i)
Write an integer |
private void |
writeList()
Write the listtable and listoverridetable to the final ByteArrayOutputStream |
private void |
writeList(List list,
ByteArrayOutputStream out)
Write a List |
private void |
writeListElement(ListItem listItem,
ByteArrayOutputStream out)
Write a ListItem |
private void |
writeMeta(byte[] metaName,
Meta meta)
Add a Meta element. |
private void |
writeParagraph(Paragraph paragraphElement,
ByteArrayOutputStream out)
Write the beginning of a new Paragraph |
private void |
writePhrase(Phrase phrase,
ByteArrayOutputStream out)
Write a Phrase . |
private void |
writeSection(Section sectionElement,
ByteArrayOutputStream out)
Write the beginning of a new Section |
private void |
writeSectionDefaults(ByteArrayOutputStream out)
Writes the default values for the current Section |
private void |
writeTable(Table table,
ByteArrayOutputStream out)
Write a Table . |
boolean |
writeTOC(String tocTitle,
Font titleFont,
boolean showTOCasEntry,
Font showTOCEntryFont)
Write the table of contents. |
boolean |
writingHeaderFooter()
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 |
public static final byte escape
private static final byte[] extendedEscape
protected static final byte delimiter
private static final byte commaDelimiter
public static final byte openGroup
public static final byte closeGroup
private static final byte[] docBegin
private static final byte[] ansi
private static final byte[] ansiCodepage
private static final byte[] fontTable
protected static final byte fontNumber
protected static final byte[] fontSize
protected static final byte[] fontColor
private static final byte[] fontModern
private static final byte[] fontSwiss
private static final byte[] fontRoman
private static final byte[] fontTech
private static final byte[] fontCharset
private static final byte[] fontCourier
private static final byte[] fontArial
private static final byte[] fontSymbol
private static final byte[] fontTimesNewRoman
private static final byte[] fontWindings
private static final byte[] defaultFont
private static final byte[] firstIndent
private static final byte[] listIndent
private static final byte[] rightIndent
private static final byte[] sectionDefaults
private static final byte[] section
public static final byte[] paragraphDefaults
public static final byte[] paragraph
public static final byte[] sectionPageWidth
public static final byte[] sectionPageHeight
private static final byte[] listtableGroup
private static final byte[] listoverridetableGroup
private static final byte[] listDefinition
private static final byte[] listTemplateID
private static final byte[] hybridList
private static final byte[] listLevelDefinition
private static final byte[] listLevelTypeOld
private static final byte[] listLevelTypeNew
private static final byte[] listLevelAlignOld
private static final byte[] listLevelAlignNew
private static final byte[] listLevelStartAt
private static final byte[] listLevelTextDefinition
private static final byte[] listLevelTextLength
private static final byte[] listLevelTextStyleNumbers
private static final byte[] listLevelTextStyleBullet
private static final byte[] listLevelNumbersDefinition
private static final byte[] listLevelNumbers
private static final byte[] tabStop
private static final byte[] listBegin
private static final byte[] listCurrentLevel
private static final byte[] listTextOld
private static final byte[] tab
private static final byte[] listBulletOld
private static final byte[] listID
private static final byte[] listOverride
private static final byte[] listOverrideCount
protected static final byte bold
protected static final byte italic
protected static final byte[] underline
protected static final byte[] strikethrough
public static final byte[] alignLeft
public static final byte[] alignCenter
public static final byte[] alignRight
public static final byte[] alignJustify
private static final byte[] colorTable
private static final byte[] colorRed
private static final byte[] colorGreen
private static final byte[] colorBlue
private static final byte[] infoBegin
private static final byte[] metaAuthor
private static final byte[] metaSubject
private static final byte[] metaKeywords
private static final byte[] metaTitle
private static final byte[] metaProducer
private static final byte[] metaCreationDate
private static final byte[] year
private static final byte[] month
private static final byte[] day
private static final byte[] hour
private static final byte[] minute
private static final byte[] second
private static final byte[] startSuper
private static final byte[] startSub
private static final byte[] endSuperSub
private static final byte[] titlePage
private static final byte[] facingPages
private static final byte[] headerBegin
private static final byte[] footerBegin
private static final byte[] headerlBegin
private static final byte[] footerlBegin
private static final byte[] headerrBegin
private static final byte[] footerrBegin
private static final byte[] headerfBegin
private static final byte[] footerfBegin
private static final byte[] rtfPaperWidth
private static final byte[] rtfPaperHeight
private static final byte[] rtfMarginLeft
private static final byte[] rtfMarginRight
private static final byte[] rtfMarginTop
private static final byte[] rtfMarginBottom
private static final byte[] newPage
private static final byte[] landscapeTag1
private static final byte[] landscapeTag2
private static final byte[] annotationID
private static final byte[] annotationAuthor
private static final byte[] annotation
private static final byte[] pictureGroup
private static final byte[] picture
private static final byte[] picturePNG
private static final byte[] pictureJPEG
private static final byte[] pictureBMP
private static final byte[] pictureWMF
private static final byte[] pictureWidth
private static final byte[] pictureHeight
private static final byte[] pictureScaleX
private static final byte[] pictureScaleY
protected static final byte[] field
protected static final byte[] fieldContent
protected static final byte[] fieldPage
protected static final byte[] fieldHyperlink
protected static final byte[] fieldDisplay
private ArrayList fontList
ArrayList
contains all fonts used in the document.
private ArrayList colorList
ArrayList
contains all colours used in the document.
private ByteArrayOutputStream content
ByteArrayOutputStream
contains the main body of the document.
private ByteArrayOutputStream info
ByteArrayOutputStream
contains the information group.
private ByteArrayOutputStream listtable
ByteArrayOutputStream
contains the list table.
private ByteArrayOutputStream listoverride
ByteArrayOutputStream
contains the list override table.
private HeaderFooter header
private HeaderFooter footer
private int marginLeft
private int marginRight
private int marginTop
private int marginBottom
private int pageWidth
private int pageHeight
public static final double TWIPSFACTOR
private int currentListID
private ArrayList listIds
private int listLevel
private int maxListLevel
private boolean writeTOC
private boolean hasTitlePage
private boolean inHeaderFooter
private boolean inTable
private boolean landscape
Constructor Detail |
protected RtfWriter(Document doc, OutputStream os)
RtfWriter
.
doc
- The Document
that is to be written as RTFos
- The OutputStream
the writer has to write to.Method Detail |
public void setGenerateTOCEntries(boolean writeTOC)
writeTOC
- boolean value indicating whether a TOC is to be generatedpublic boolean getGeneratingTOCEntries()
public void setHasTitlePage(boolean hasTitlePage)
hasTitlePage
- boolean value indicating whether the first page is a title pagepublic boolean getHasTitlePage()
public void setLandscape(boolean landscape)
landscape
- boolean value indicating whether we are using landscape format or notpublic boolean getLandscape()
public static RtfWriter getInstance(Document document, OutputStream os)
RtfWriter
.
document
- The Document
that has to be writtenos
- The OutputStream
the writer has to write to.
RtfWriter
public void open()
Document
has been opened and that
Elements
can be added.
open
in interface DocListener
open
in class DocWriter
public void close()
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
close
in interface DocListener
close
in class DocWriter
public void setFooter(HeaderFooter footer)
Document
.
setFooter
in interface DocListener
setFooter
in class DocWriter
footer
- the new footerpublic void setHeader(HeaderFooter header)
Document
.
setHeader
in interface DocListener
setHeader
in class DocWriter
header
- the new headerpublic void resetFooter()
resetFooter
in interface DocListener
resetFooter
in class DocWriter
public void resetHeader()
resetHeader
in interface DocListener
resetHeader
in class DocWriter
public boolean newPage() throws DocumentException
RtfWriter
that a new page is to be begun.
newPage
in interface DocListener
newPage
in class DocWriter
true
if a new Page was begun.
DocumentException
- if the Document was not open or had been closed.public boolean setMargins(float marginLeft, float marginRight, float marginTop, float marginBottom)
setMargins
in interface DocListener
setMargins
in class DocWriter
marginLeft
- The left marginmarginRight
- The right marginmarginTop
- The top marginmarginBottom
- The bottom margin
true
if the page margins were set.public boolean setPageSize(Rectangle pageSize)
setPageSize
in interface DocListener
setPageSize
in class DocWriter
pageSize
- A Rectangle
specifying the page size
true
if the page size was setpublic boolean writeTOC(String tocTitle, Font titleFont, boolean showTOCasEntry, Font showTOCEntryFont)
tocTitle
- The title that will be displayed above the TOCtitleFont
- The Font
that will be used for the tocTitleshowTOCasEntry
- Set this to true if you want the TOC to appear as an entry in the TOCshowTOCEntryFont
- Use this Font
to specify what Font to use when showTOCasEntry is true
true
if the TOC was added.public boolean add(Element element) throws DocumentException
Element
was added to the Document
.
add
in interface ElementListener
add
in class DocWriter
true
if the element was added, false
if not.
DocumentException
- if a document isn't open yet, or has been closedprotected boolean addElement(Element element, ByteArrayOutputStream out) throws DocumentException
Element
to the Document
.
true
if the element was added, false
if not.
DocumentException
- if a document isn't open yet, or has been closedprivate void writeSection(Section sectionElement, ByteArrayOutputStream out) throws IOException, DocumentException
Section
sectionElement
- The Section
be writtenout
- The ByteArrayOutputStream
to write to
IOException
DocumentException
private void writeParagraph(Paragraph paragraphElement, ByteArrayOutputStream out) throws IOException
Paragraph
paragraphElement
- The Paragraph
to be writtenout
- The ByteArrayOutputStream
to write to
IOException
private void writePhrase(Phrase phrase, ByteArrayOutputStream out) throws IOException
Phrase
.
phrase
- The Phrase
item to be writtenout
- The ByteArrayOutputStream
to write to
IOException
private void writeAnchor(Anchor anchor, ByteArrayOutputStream out) throws IOException
Anchor
. Anchors are treated like Phrases.
anchor
- The Chunk
item to be writtenout
- The ByteArrayOutputStream
to write to
IOException
private void writeChunk(Chunk chunk, ByteArrayOutputStream out) throws IOException, DocumentException
Chunk
and all its font properties.
chunk
- The Chunk
item to be writtenout
- The ByteArrayOutputStream
to write to
IOException
DocumentException
protected void writeInitialFontSignature(OutputStream out, Chunk chunk) throws IOException
IOException
protected void writeFinishingFontSignature(OutputStream out, Chunk chunk) throws IOException
IOException
private void writeListElement(ListItem listItem, ByteArrayOutputStream out) throws IOException, DocumentException
ListItem
listItem
- The ListItem
to be writtenout
- The ByteArrayOutputStream
to write to
IOException
DocumentException
private void writeList(List list, ByteArrayOutputStream out) throws IOException, DocumentException
List
list
- The List
to be writtenout
- The ByteArrayOutputStream
to write to
IOException
DocumentException
private void writeTable(Table table, ByteArrayOutputStream out) throws IOException, DocumentException
Table
.
table
- The table
to be writtenout
- The ByteArrayOutputStream
to write to
Currently no nesting of tables is supported. If a cell contains anything but a Cell Object it is ignored.
IOException
DocumentException
private void writeImage(Image image, ByteArrayOutputStream out) throws IOException, DocumentException
Image
.
image
- The image
to be writtenout
- The ByteArrayOutputStream
to write to
At the moment only PNG and JPEG Images are supported.
IOException
DocumentException
private void writeAnnotation(Annotation annotationElement, ByteArrayOutputStream out) throws IOException
Annotation
annotationElement
- The Annotation
to be writtenout
- The ByteArrayOutputStream
to write to
IOException
private void writeMeta(byte[] metaName, Meta meta) throws IOException
Meta
element. It is written to the Inforamtion Group
and merged with the main ByteArrayOutputStream
when the
Document is closed.
metaName
- The type of Meta
element to be addedmeta
- The Meta
element to be added
Currently only the Meta Elements Author, Subject, Keywords, Title, Producer and CreationDate are supported.
IOException
private void writeFormatedDateTime(String date) throws IOException
date
- The date to be written
IOException
protected int addFont(Font newFont)
Font
to the list of fonts. If the Font
already exists in the list of fonts, then it is not added again.
newFont
- The Font
to be added
Font
in the font listprotected int addColor(Color newColor)
Color
to the list of colours. If the Color
already exists in the list of colours, then it is not added again.
newColor
- The Color
to be added
color
in the colour listprivate boolean writeDocument()
ArrayList
s and ByteArrayOutputStream
s
to the final ByteArrayOutputStream
true
if all information was sucessfully written to the ByteArrayOutputStream
private void writeDocumentIntro() throws IOException
IOException
private void writeFontList() throws IOException
ByteArrayOutputStream
IOException
private void writeColorList() throws IOException
ByteArrayOutputStream
IOException
private void writeInfoGroup() throws IOException
ByteArrayOutputStream
IOException
private void writeList() throws IOException
ByteArrayOutputStream
IOException
public static final void writeInt(OutputStream out, int i) throws IOException
out
- The OuputStream
to which the int
value is to be writteni
- The int
value to be written
IOException
private int getRandomInt()
int
value.public void writeHeadersFooters(ByteArrayOutputStream os) throws IOException
ByteArrayOutputStream
os
- The ByteArrayOutputStream
to which the header and footer will be written.
IOException
private void writeHeaderFooter(HeaderFooter headerFooter, byte[] hfType, ByteArrayOutputStream target) throws IOException
HeaderFooter
to a ByteArrayOutputStream
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.
IOException
private void writeDocumentFormat() throws IOException
Document
's Paper and Margin Size
to the final ByteArrayOutputStream
IOException
private void initDefaults()
ByteArrayOutputStream
's
private void writeSectionDefaults(ByteArrayOutputStream out) throws IOException
out
- The ByteArrayOutputStream
to be written to
IOException
private boolean parseFormat(Rectangle pageSize, boolean rotate)
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.
private boolean rectEquals(Rectangle rect1, Rectangle rect2)
public boolean writingHeaderFooter()
public static final String filterSpecialChar(String str)
str
- The original String
private void addHeaderFooterFontColor(HeaderFooter hf)
private void processHeaderFooter(HeaderFooter hf)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |