Java Doc for RtfWriter.java in  » PDF » pdf-itext » com » lowagie » text » rtf » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » PDF » pdf itext » com.lowagie.text.rtf 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


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

RtfWriter
public class RtfWriter extends DocWriter (Code)
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:

  • Watermarks
  • Viewer preferences
  • Encryption
  • Embedded fonts
  • Phrases with a leading
  • Lists with non-bullet symbols
  • Nested tables
  • Images other than JPEG and PNG
  • Rotated images


author:
   Mark Hall (mhall@edu.uni-klu.ac.at)
author:
   Steffen Stundzig (Steffen.Stundzig@smb-tec.com)
author:
   Eric Mattes (ericmattes@yahoo.com)
author:
   Raul Wegmann (raul.wegmann@uam.es)


Field Summary
final public static  doubleTWIPSFACTOR
     Factor to use when converting.
final public static  byte[]alignCenter
     Text alignment center tag.
final public static  byte[]alignJustify
     Text alignment justify tag.
final public static  byte[]alignLeft
     Text alignment left tag.
final public static  byte[]alignRight
     Text alignment right tag.
final protected static  bytebold
     Bold tag.
final public static  bytecloseGroup
     This is the character for closing a group.
final protected static  bytedelimiter
     This is the delimiter between RTF tags and normal text.
final public static  byteescape
     This is the escape character which introduces RTF tags.
final protected static  byte[]field
    
final protected static  byte[]fieldContent
    
final protected static  byte[]fieldDisplay
    
final protected static  byte[]fieldHyperlink
    
final protected static  byte[]fieldPage
    
final protected static  byte[]fontColor
     Font color tag.
final protected static  bytefontNumber
     Font number tag.
final protected static  byte[]fontSize
     Font size tag.
final protected static  byteitalic
     Italic tag.
final public static  byteopenGroup
     This is the character for beginning a new group.
final public static  byte[]paragraph
     Begin new paragraph tag.
final public static  byte[]paragraphDefaults
     Reset paragraph defaults tag.
final public static  byte[]sectionPageHeight
     Page height of a section.
final public static  byte[]sectionPageWidth
     Page width of a section.
final protected static  byte[]strikethrough
     Strikethrough tag.
final protected static  byte[]underline
     Underline tag.

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

Method Summary
public  booleanadd(Element element)
     Signals that an Element was added to the Document.
protected  intaddColor(Color newColor)
     Add a new Color to the list of colours.
protected  booleanaddElement(Element element, ByteArrayOutputStream out)
     Adds an Element to the Document.
protected  intaddFont(Font newFont)
     Add a new Font to the list of fonts.
public  voidclose()
     Signals that the Document was closed and that no other Elements will be added.
final public static  StringfilterSpecialChar(String str, boolean useHex)
    
public  booleangetGeneratingTOCEntries()
    
public  booleangetHasTitlePage()
    
public static  RtfWritergetInstance(Document document, OutputStream os)
     Gets an instance of the RtfWriter.
Parameters:
  document - The Document that has to be written
Parameters:
  os - The OutputStream the writer has to write to.
public  booleangetLandscape()
    
public  booleannewPage()
     Tells the RtfWriter that a new page is to be begun.
public  voidresetFooter()
     Resets the footer.
public  voidresetHeader()
     Resets the header.
public  voidsetFooter(HeaderFooter footer)
     Adds the footer to the bottom of the Document.
public  voidsetGenerateTOCEntries(boolean writeTOC)
    
public  voidsetHasTitlePage(boolean hasTitlePage)
    
public  voidsetHeader(HeaderFooter header)
     Adds the header to the top of the Document.
public  voidsetLandscape(boolean landscape)
     Explicitly sets the page format to use.
public  booleansetMarginMirroring(boolean MarginMirroring)
    
public  booleansetMargins(float marginLeft, float marginRight, float marginTop, float marginBottom)
    
public  booleansetPageSize(Rectangle pageSize)
    
protected  voidwriteFinishingFontSignature(OutputStream out, Chunk chunk)
    
public  voidwriteHeadersFooters(ByteArrayOutputStream os)
    
protected  voidwriteInitialFontSignature(OutputStream out, Chunk chunk)
    
final public static  voidwriteInt(OutputStream out, int i)
    
public  booleanwriteTOC(String tocTitle, Font titleFont, boolean showTOCasEntry, Font showTOCEntryFont)
     Write the table of contents.
public  booleanwritingHeaderFooter()
    

Field Detail
TWIPSFACTOR
final public static double TWIPSFACTOR(Code)
Factor to use when converting.



alignCenter
final public static byte[] alignCenter(Code)
Text alignment center tag.



alignJustify
final public static byte[] alignJustify(Code)
Text alignment justify tag.



alignLeft
final public static byte[] alignLeft(Code)
Text alignment left tag.



alignRight
final public static byte[] alignRight(Code)
Text alignment right tag.



bold
final protected static byte bold(Code)
Bold tag.



closeGroup
final public static byte closeGroup(Code)
This is the character for closing a group.



delimiter
final protected static byte delimiter(Code)
This is the delimiter between RTF tags and normal text.



escape
final public static byte escape(Code)
This is the escape character which introduces RTF tags.



field
final protected static byte[] field(Code)
Begin field tag



fieldContent
final protected static byte[] fieldContent(Code)
Content fo the field



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



fieldHyperlink
final protected static byte[] fieldHyperlink(Code)
HYPERLINK field



fieldPage
final protected static byte[] fieldPage(Code)
PAGE numbers



fontColor
final protected static byte[] fontColor(Code)
Font color tag.



fontNumber
final protected static byte fontNumber(Code)
Font number tag.



fontSize
final protected static byte[] fontSize(Code)
Font size tag.



italic
final protected static byte italic(Code)
Italic tag.



openGroup
final public static byte openGroup(Code)
This is the character for beginning a new group.



paragraph
final public static byte[] paragraph(Code)
Begin new paragraph tag.



paragraphDefaults
final public static byte[] paragraphDefaults(Code)
Reset paragraph defaults tag.



sectionPageHeight
final public static byte[] sectionPageHeight(Code)
Page height of a section.



sectionPageWidth
final public static byte[] sectionPageWidth(Code)
Page width of a section.



strikethrough
final protected static byte[] strikethrough(Code)
Strikethrough tag.



underline
final protected static byte[] underline(Code)
Underline tag.




Constructor Detail
RtfWriter
protected RtfWriter(Document doc, OutputStream os)(Code)
Constructs a RtfWriter.
Parameters:
  doc - The Document that is to be written as RTF
Parameters:
  os - The OutputStream the writer has to write to.




Method Detail
add
public boolean add(Element element) throws DocumentException(Code)
Signals that an Element was added to the Document.
Parameters:
  element - A high level object to add true if the element was added, false if not.
throws:
  DocumentException - if a document isn't open yet, or has been closed



addColor
protected int addColor(Color newColor)(Code)
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 The index of the color in the colour list



addElement
protected boolean addElement(Element element, ByteArrayOutputStream out) throws DocumentException(Code)
Adds an Element to the Document.
Parameters:
  element - the high level element to add
Parameters:
  out - the outputstream to which the RTF data is sent true if the element was added, false if not.
throws:
  DocumentException - if a document isn't open yet, or has been closed



addFont
protected int addFont(Font newFont)(Code)
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 The index of the Font in the font list



close
public void close()(Code)
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




filterSpecialChar
final public static String filterSpecialChar(String str, boolean useHex)(Code)
Replaces special characters with their unicode values
Parameters:
  str - The original String
Parameters:
  useHex - The converted String



getGeneratingTOCEntries
public boolean getGeneratingTOCEntries()(Code)
Gets the current setting of writeTOC boolean value indicating whether a TOC is being generated



getHasTitlePage
public boolean getHasTitlePage()(Code)
Gets the current setting of hasTitlePage boolean value indicating whether the first page is a title page



getInstance
public static RtfWriter getInstance(Document document, OutputStream os)(Code)
Gets an instance of the RtfWriter.
Parameters:
  document - The Document that has to be written
Parameters:
  os - The OutputStream the writer has to write to. a new RtfWriter



getLandscape
public boolean getLandscape()(Code)
Returns the current landscape setting boolean value indicating the current page format



newPage
public boolean newPage()(Code)
Tells the RtfWriter that a new page is to be begun. true if a new Page was begun.
throws:
  DocumentException - if the Document was not open or had been closed.



resetFooter
public void resetFooter()(Code)
Resets the footer.



resetHeader
public void resetHeader()(Code)
Resets the header.



setFooter
public void setFooter(HeaderFooter footer)(Code)
Adds the footer to the bottom of the Document.
Parameters:
  footer -



setGenerateTOCEntries
public void setGenerateTOCEntries(boolean writeTOC)(Code)
This method controls whether TOC entries are automatically generated
Parameters:
  writeTOC - boolean value indicating whether a TOC is to be generated



setHasTitlePage
public void setHasTitlePage(boolean hasTitlePage)(Code)
This method controls whether the first page is a title page
Parameters:
  hasTitlePage - boolean value indicating whether the first page is a title page



setHeader
public void setHeader(HeaderFooter header)(Code)
Adds the header to the top of the Document.
Parameters:
  header -



setLandscape
public void setLandscape(boolean landscape)(Code)
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



setMarginMirroring
public boolean setMarginMirroring(boolean MarginMirroring)(Code)

See Also:   com.lowagie.text.DocListener.setMarginMirroring(boolean)



setMargins
public boolean setMargins(float marginLeft, float marginRight, float marginTop, float marginBottom)(Code)
Sets the page margins
Parameters:
  marginLeft - The left margin
Parameters:
  marginRight - The right margin
Parameters:
  marginTop - The top margin
Parameters:
  marginBottom - The bottom margin true if the page margins were set.



setPageSize
public boolean setPageSize(Rectangle pageSize)(Code)
Sets the page size
Parameters:
  pageSize - A Rectangle specifying the page size true if the page size was set



writeFinishingFontSignature
protected void writeFinishingFontSignature(OutputStream out, Chunk chunk) throws IOException(Code)



writeHeadersFooters
public void writeHeadersFooters(ByteArrayOutputStream os) throws IOException(Code)
Write the current header and footer to a ByteArrayOutputStream
Parameters:
  os - The ByteArrayOutputStream to which the header and footer will be written.
throws:
  IOException -



writeInitialFontSignature
protected void writeInitialFontSignature(OutputStream out, Chunk chunk) throws IOException(Code)



writeInt
final public static void writeInt(OutputStream out, int i) throws IOException(Code)
Write an integer
Parameters:
  out - The OuputStream to which the int value is to be written
Parameters:
  i - The int value to be written
throws:
  IOException -



writeTOC
public boolean writeTOC(String tocTitle, Font titleFont, boolean showTOCasEntry, Font showTOCEntryFont)(Code)
Write the table of contents.
Parameters:
  tocTitle - The title that will be displayed above the TOC
Parameters:
  titleFont - The Font that will be used for the tocTitle
Parameters:
  showTOCasEntry - Set this to true if you want the TOC to appear as an entry in the TOC
Parameters:
  showTOCEntryFont - Use this Font to specify what Font to use when showTOCasEntry is true true if the TOC was added.



writingHeaderFooter
public boolean writingHeaderFooter()(Code)
Returns whether we are currently writing a header or footer the value of inHeaderFooter



Fields inherited from com.lowagie.text.DocWriter
final public static byte EQUALS(Code)(Java Doc)
final public static byte FORWARD(Code)(Java Doc)
final public static byte GT(Code)(Java Doc)
final public static byte LT(Code)(Java Doc)
final public static byte NEWLINE(Code)(Java Doc)
final public static byte QUOTE(Code)(Java Doc)
final public static byte SPACE(Code)(Java Doc)
final public static byte TAB(Code)(Java Doc)
protected boolean closeStream(Code)(Java Doc)
protected Document document(Code)(Java Doc)
protected boolean open(Code)(Java Doc)
protected OutputStreamCounter os(Code)(Java Doc)
protected Rectangle pageSize(Code)(Java Doc)
protected boolean pause(Code)(Java Doc)

Methods inherited from com.lowagie.text.DocWriter
public boolean add(Element element) throws DocumentException(Code)(Java Doc)
protected void addTabs(int indent) throws IOException(Code)(Java Doc)
public void close()(Code)(Java Doc)
public void flush()(Code)(Java Doc)
final public static byte[] getISOBytes(String text)(Code)(Java Doc)
public boolean isCloseStream()(Code)(Java Doc)
public boolean isPaused()(Code)(Java Doc)
public boolean newPage()(Code)(Java Doc)
public void open()(Code)(Java Doc)
public void pause()(Code)(Java Doc)
public void resetFooter()(Code)(Java Doc)
public void resetHeader()(Code)(Java Doc)
public void resetPageCount()(Code)(Java Doc)
public void resume()(Code)(Java Doc)
public void setCloseStream(boolean closeStream)(Code)(Java Doc)
public void setFooter(HeaderFooter footer)(Code)(Java Doc)
public void setHeader(HeaderFooter header)(Code)(Java Doc)
public boolean setMarginMirroring(boolean MarginMirroring)(Code)(Java Doc)
public boolean setMargins(float marginLeft, float marginRight, float marginTop, float marginBottom)(Code)(Java Doc)
public void setPageCount(int pageN)(Code)(Java Doc)
public boolean setPageSize(Rectangle pageSize)(Code)(Java Doc)
protected void write(String string) throws IOException(Code)(Java Doc)
protected void write(String key, String value) throws IOException(Code)(Java Doc)
protected void writeEnd(String tag) throws IOException(Code)(Java Doc)
protected void writeEnd() throws IOException(Code)(Java Doc)
protected boolean writeMarkupAttributes(Properties markup) throws IOException(Code)(Java Doc)
protected void writeStart(String tag) throws IOException(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.