Java Doc for HtmlWriter.java in  » PDF » pdf-itext » com » lowagie » text » html » 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.html 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.lowagie.text.DocWriter
      com.lowagie.text.html.HtmlWriter

HtmlWriter
public class HtmlWriter extends DocWriter (Code)
A DocWriter class for HTML.

An HtmlWriter 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 HtmlWriter.

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 HTML to the Standard OutputStream
 HtmlWriter.getInstance(document, System.out);
 // this will write HTML to a file called text.html
 HtmlWriter.getInstance(document, new FileOutputStream("text.html"));
 // this will write HTML to for instance the OutputStream of a HttpServletResponse-object
 HtmlWriter.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();
 


Field Summary
final public static  byte[]BEGINCOMMENT
     This is a possible HTML-tag.
final public static  byte[]ENDCOMMENT
     This is a possible HTML-tag.
final public static  StringNBSP
     This is a possible HTML-tag.
protected  Stackcurrentfont
     This is the current font of the HTML.
protected  HeaderFooterfooter
    
protected  HeaderFooterheader
    
protected  Stringimagepath
     This is a path for images.
protected  Propertiesmarkup
     Store the markup properties of a MarkedObject.
protected  intpageN
     Stores the page number.
protected  Fontstandardfont
     This is the standard font of the HTML.

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

Method Summary
public  booleanadd(Element element)
     Signals that an Element was added to the Document.
public  booleanadd(String string)
     Signals that a String was added to the Document.
public  voidclose()
     Signals that the Document was closed and that no other Elements will be added.
public static  HtmlWritergetInstance(Document document, OutputStream os)
     Gets an instance of the HtmlWriter.
Parameters:
  document - The Document that has to be written
Parameters:
  os - The OutputStream the writer has to write to.
protected  voidinitFooter()
    
protected  voidinitHeader()
    
public  booleanisOtherFont(Font font)
     Checks if a given font is the same as the font that was last used.
public  booleannewPage()
     Signals that an new page has to be started.
public  voidopen()
     Signals that the Document has been opened and that Elements can be added.
public  voidresetImagepath()
     Resets the imagepath.
public  voidsetFooter(HeaderFooter footer)
     Changes the footer of this document.
public  voidsetHeader(HeaderFooter header)
     Changes the header of this document.
public  voidsetImagepath(String imagepath)
     Sets the basepath for images.

This is especially useful if you add images using a file, rather than an URL.

public  voidsetStandardFont(Font standardfont)
     Changes the standardfont.
protected  voidwrite(Element element, int indent)
     Writes the HTML representation of an element.
protected  voidwrite(Font font, Properties styleAttributes)
     Writes the representation of a Font.
protected  voidwriteComment(String comment)
     Writes some comment.
protected  voidwriteCssProperty(String prop, String value)
     Writes out a CSS property.
protected  voidwriteHeader(Meta meta)
     Writes a Metatag in the header.
protected  voidwriteJavaScript(Header header)
     Writes a JavaScript section or, if the markup attribute HtmlTags.URL is set, a JavaScript reference in the header.
protected  voidwriteLink(Header header)
     Writes a link in the header.
protected  voidwriteSection(Section section, int indent)
     Writes the HTML representation of a section.

Field Detail
BEGINCOMMENT
final public static byte[] BEGINCOMMENT(Code)
This is a possible HTML-tag.



ENDCOMMENT
final public static byte[] ENDCOMMENT(Code)
This is a possible HTML-tag.



NBSP
final public static String NBSP(Code)
This is a possible HTML-tag.



currentfont
protected Stack currentfont(Code)
This is the current font of the HTML.



footer
protected HeaderFooter footer(Code)
This is the textual part of the footer



header
protected HeaderFooter header(Code)
This is the textual part of a header



imagepath
protected String imagepath(Code)
This is a path for images.



markup
protected Properties markup(Code)
Store the markup properties of a MarkedObject.



pageN
protected int pageN(Code)
Stores the page number.



standardfont
protected Font standardfont(Code)
This is the standard font of the HTML.




Constructor Detail
HtmlWriter
protected HtmlWriter(Document doc, OutputStream os)(Code)
Constructs a HtmlWriter.
Parameters:
  doc - The Document that has to be written as HTML
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 that has to be translated to HTML true if the element was added, false if not.
throws:
  DocumentException - when a document isn't open yet, or has been closed



add
public boolean add(String string)(Code)
Signals that a String was added to the Document.
Parameters:
  string - a String to add to the HTML true if the string was added, false if not.
throws:
  DocumentException - when a document isn't open yet, or has been closed



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



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



initFooter
protected void initFooter()(Code)
Adds the header to the top of the Document



initHeader
protected void initHeader()(Code)
Adds the header to the top of the Document



isOtherFont
public boolean isOtherFont(Font font)(Code)
Checks if a given font is the same as the font that was last used.
Parameters:
  font - the font of an object true if the font differs



newPage
public boolean newPage()(Code)
Signals that an new page has to be started. true if this action succeeded, false if not.
throws:
  DocumentException - when a document isn't open yet, or has been closed



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

The HEAD-section of the HTML-document is written.




resetImagepath
public void resetImagepath()(Code)
Resets the imagepath.



setFooter
public void setFooter(HeaderFooter footer)(Code)
Changes the footer of this document.
Parameters:
  footer - the new footer



setHeader
public void setHeader(HeaderFooter header)(Code)
Changes the header of this document.
Parameters:
  header - the new header



setImagepath
public void setImagepath(String imagepath)(Code)
Sets the basepath for images.

This is especially useful if you add images using a file, rather than an URL. In PDF there is no problem, since the images are added inline, but in HTML it is sometimes necessary to use a relative path or a special path to some images directory.
Parameters:
  imagepath - the new imagepath




setStandardFont
public void setStandardFont(Font standardfont)(Code)
Changes the standardfont.
Parameters:
  standardfont - The font



write
protected void write(Element element, int indent) throws IOException(Code)
Writes the HTML representation of an element.
Parameters:
  element - the element
Parameters:
  indent - the indentation
throws:
  IOException -



write
protected void write(Font font, Properties styleAttributes) throws IOException(Code)
Writes the representation of a Font.
Parameters:
  font - a Font
Parameters:
  styleAttributes - the style of the font
throws:
  IOException -



writeComment
protected void writeComment(String comment) throws IOException(Code)
Writes some comment.

This method writes some comment.
Parameters:
  comment - the comment that has to be written
throws:
  IOException -




writeCssProperty
protected void writeCssProperty(String prop, String value) throws IOException(Code)
Writes out a CSS property.
Parameters:
  prop - a CSS property
Parameters:
  value - the value of the CSS property
throws:
  IOException -



writeHeader
protected void writeHeader(Meta meta) throws IOException(Code)
Writes a Metatag in the header.
Parameters:
  meta - the element that has to be written
throws:
  IOException -



writeJavaScript
protected void writeJavaScript(Header header) throws IOException(Code)
Writes a JavaScript section or, if the markup attribute HtmlTags.URL is set, a JavaScript reference in the header.
Parameters:
  header - the element that has to be written
throws:
  IOException -



writeLink
protected void writeLink(Header header) throws IOException(Code)
Writes a link in the header.
Parameters:
  header - the element that has to be written
throws:
  IOException -



writeSection
protected void writeSection(Section section, int indent) throws IOException(Code)
Writes the HTML representation of a section.
Parameters:
  section - the section to write
Parameters:
  indent - the indentation
throws:
  IOException -



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.