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


java.lang.Object
   com.lowagie.text.Document

All known Subclasses:   com.lowagie.text.pdf.PdfDocument,
Document
public class Document implements DocListener(Code)
A generic Document class.

All kinds of Text-elements can be added to a HTMLDocument. The Document signals all the listeners when an element has been added.

Remark:

  1. Once a document is created you can add some meta information.
  2. You can also set the headers/footers.
  3. You have to open the document before you can write content.
  4. You can only write content (no more meta-formation!) once a document is opened.
  5. When you change the header/footer on a certain page, this will be effective starting on the next page.
  6. Ater closing the document, every listener (as well as its OutputStream) is closed too.
Example:
// creation of the document with a certain size and certain margins
 Document document = new Document(PageSize.A4, 50, 50, 50, 50);
  try { 
 // creation of the different writers 
 HtmlWriter.getInstance(document , System.out);
 PdfWriter.getInstance(document , new FileOutputStream("text.pdf"));
 // we add some meta information to the document
 document.addAuthor("Bruno Lowagie"); 
 document.addSubject("This is the result of a Test."); 
 // we open the document for writing
 document.open(); 
 document.add(new Paragraph("Hello world"));
 } catch(DocumentException de) {
 System.err.println(de.getMessage());
 }
 document.close();
 


Field Summary
protected  intchapternumber
     This is a chapter number in case ChapterAutoNumber is used.
protected  booleanclose
    
public static  booleancompress
     Allows the pdf documents to be produced without compression for debugging purposes.
protected  HeaderFooterfooter
    
protected  HeaderFooterheader
    
protected  StringhtmlStyleClass
    
protected  StringjavaScript_onLoad
    
protected  StringjavaScript_onUnLoad
    
protected  floatmarginBottom
    
protected  floatmarginLeft
    
protected  booleanmarginMirroring
    
protected  floatmarginRight
    
protected  floatmarginTop
    
protected  booleanopen
    
protected  intpageN
    
protected  RectanglepageSize
     The size of the page.
public static  booleanplainRandomAccess
     When true the file access is not done through a memory mapped file.

Constructor Summary
public  Document()
     Constructs a new Document -object.
public  Document(Rectangle pageSize)
     Constructs a new Document -object.
public  Document(Rectangle pageSize, float marginLeft, float marginRight, float marginTop, float marginBottom)
     Constructs a new Document -object.

Method Summary
public  booleanadd(Element element)
     Adds an Element to the Document.
public  booleanaddAuthor(String author)
     Adds the author to a Document.
public  booleanaddCreationDate()
     Adds the current date and time to a Document.
public  booleanaddCreator(String creator)
     Adds the creator to a Document.
public  voidaddDocListener(DocListener listener)
     Adds a DocListener to the Document.
public  booleanaddHeader(String name, String content)
     Adds a user defined header to the document.
public  booleanaddKeywords(String keywords)
     Adds the keywords to a Document.
public  booleanaddProducer()
     Adds the producer to a Document.
public  booleanaddSubject(String subject)
     Adds the subject to a Document.
public  booleanaddTitle(String title)
     Adds the title to a Document.
public  floatbottom()
     Returns the lower left y-coordinate.
public  floatbottom(float margin)
     Returns the lower left y-coordinate, considering a given margin.
public  floatbottomMargin()
     Returns the bottom margin.
public  voidclose()
     Closes the document.

Once all the content has been written in the body, you have to close the body.

public  StringgetHtmlStyleClass()
    
public  StringgetJavaScript_onLoad()
     Gets the JavaScript onLoad command.
public  StringgetJavaScript_onUnLoad()
     Gets the JavaScript onUnLoad command.
public  intgetPageNumber()
     Returns the current page number.
public  RectanglegetPageSize()
     Gets the pagesize.
final public static  StringgetVersion()
     Gets the iText version.
public  booleanisMarginMirroring()
     Gets the margin mirroring flag.
public  booleanisOpen()
     Checks if the document is open.
public  floatleft()
     Returns the lower left x-coordinate.
public  floatleft(float margin)
     Returns the lower left x-coordinate considering a given margin.
public  floatleftMargin()
     Returns the left margin.
public  booleannewPage()
     Signals that an new page has to be started.
public  voidopen()
     Opens the document.

Once the document is opened, you can't write any Header- or Meta-information anymore.

public  voidremoveDocListener(DocListener listener)
     Removes a DocListener from the Document.
public  voidresetFooter()
     Resets the footer of this document.
public  voidresetHeader()
     Resets the header of this document.
public  voidresetPageCount()
     Sets the page number to 0.
public  floatright()
     Returns the upper right x-coordinate.
public  floatright(float margin)
     Returns the upper right x-coordinate, considering a given margin.
public  floatrightMargin()
     Return the right margin.
public  voidsetFooter(HeaderFooter footer)
     Changes the footer of this document.
public  voidsetHeader(HeaderFooter header)
     Changes the header of this document.
public  voidsetHtmlStyleClass(String htmlStyleClass)
    
public  voidsetJavaScript_onLoad(String code)
    
public  voidsetJavaScript_onUnLoad(String code)
    
public  booleansetMarginMirroring(boolean marginMirroring)
     Set the margin mirroring.
public  booleansetMargins(float marginLeft, float marginRight, float marginTop, float marginBottom)
     Sets the margins.
public  voidsetPageCount(int pageN)
     Sets the page number.
public  booleansetPageSize(Rectangle pageSize)
     Sets the pagesize.
public  floattop()
     Returns the upper right y-coordinate.
public  floattop(float margin)
     Returns the upper right y-coordinate, considering a given margin.
public  floattopMargin()
     Returns the top margin.

Field Detail
chapternumber
protected int chapternumber(Code)
This is a chapter number in case ChapterAutoNumber is used.



close
protected boolean close(Code)
Has the document already been closed?



compress
public static boolean compress(Code)
Allows the pdf documents to be produced without compression for debugging purposes.



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 Page; it can contain a header



htmlStyleClass
protected String htmlStyleClass(Code)
Style class in HTML body tag



javaScript_onLoad
protected String javaScript_onLoad(Code)
Content of JavaScript onLoad function



javaScript_onUnLoad
protected String javaScript_onUnLoad(Code)
Content of JavaScript onUnLoad function



marginBottom
protected float marginBottom(Code)
margin in y direction starting from the bottom



marginLeft
protected float marginLeft(Code)
margin in x direction starting from the left



marginMirroring
protected boolean marginMirroring(Code)



marginRight
protected float marginRight(Code)
margin in x direction starting from the right



marginTop
protected float marginTop(Code)
margin in y direction starting from the top



open
protected boolean open(Code)
Is the document open or not?



pageN
protected int pageN(Code)
Current pagenumber



pageSize
protected Rectangle pageSize(Code)
The size of the page.



plainRandomAccess
public static boolean plainRandomAccess(Code)
When true the file access is not done through a memory mapped file. Use it if the file is too big to be mapped in your address space.




Constructor Detail
Document
public Document()(Code)
Constructs a new Document -object.



Document
public Document(Rectangle pageSize)(Code)
Constructs a new Document -object.
Parameters:
  pageSize - the pageSize



Document
public Document(Rectangle pageSize, float marginLeft, float marginRight, float marginTop, float marginBottom)(Code)
Constructs a new Document -object.
Parameters:
  pageSize - the pageSize
Parameters:
  marginLeft - the margin on the left
Parameters:
  marginRight - the margin on the right
Parameters:
  marginTop - the margin on the top
Parameters:
  marginBottom - the margin on the bottom




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



addAuthor
public boolean addAuthor(String author)(Code)
Adds the author to a Document.
Parameters:
  author - the name of the author true if successful, false otherwise



addCreationDate
public boolean addCreationDate()(Code)
Adds the current date and time to a Document. true if successful, false otherwise



addCreator
public boolean addCreator(String creator)(Code)
Adds the creator to a Document.
Parameters:
  creator - the name of the creator true if successful, false otherwise



addDocListener
public void addDocListener(DocListener listener)(Code)
Adds a DocListener to the Document.
Parameters:
  listener - the new DocListener.



addHeader
public boolean addHeader(String name, String content)(Code)
Adds a user defined header to the document.
Parameters:
  name - the name of the header
Parameters:
  content - the content of the header true if successful, false otherwise



addKeywords
public boolean addKeywords(String keywords)(Code)
Adds the keywords to a Document.
Parameters:
  keywords - adds the keywords to the document true if successful, false otherwise



addProducer
public boolean addProducer()(Code)
Adds the producer to a Document. true if successful, false otherwise



addSubject
public boolean addSubject(String subject)(Code)
Adds the subject to a Document.
Parameters:
  subject - the subject true if successful, false otherwise



addTitle
public boolean addTitle(String title)(Code)
Adds the title to a Document.
Parameters:
  title - the title true if successful, false otherwise



bottom
public float bottom()(Code)
Returns the lower left y-coordinate. the lower left y-coordinate



bottom
public float bottom(float margin)(Code)
Returns the lower left y-coordinate, considering a given margin.
Parameters:
  margin - a margin the lower left y-coordinate



bottomMargin
public float bottomMargin()(Code)
Returns the bottom margin. the bottom margin



close
public void close()(Code)
Closes the document.

Once all the content has been written in the body, you have to close the body. After that nothing can be written to the body anymore.




getHtmlStyleClass
public String getHtmlStyleClass()(Code)
Gets the style class of the HTML body tag the style class of the HTML body tag



getJavaScript_onLoad
public String getJavaScript_onLoad()(Code)
Gets the JavaScript onLoad command. the JavaScript onLoad command



getJavaScript_onUnLoad
public String getJavaScript_onUnLoad()(Code)
Gets the JavaScript onUnLoad command. the JavaScript onUnLoad command



getPageNumber
public int getPageNumber()(Code)
Returns the current page number. the current page number



getPageSize
public Rectangle getPageSize()(Code)
Gets the pagesize. the page size



getVersion
final public static String getVersion()(Code)
Gets the iText version. This method may only be changed by Paulo Soares and/or Bruno Lowagie. iText version



isMarginMirroring
public boolean isMarginMirroring()(Code)
Gets the margin mirroring flag. the margin mirroring flag



isOpen
public boolean isOpen()(Code)
Checks if the document is open. true if the document is open



left
public float left()(Code)
Returns the lower left x-coordinate. the lower left x-coordinate



left
public float left(float margin)(Code)
Returns the lower left x-coordinate considering a given margin.
Parameters:
  margin - a margin the lower left x-coordinate



leftMargin
public float leftMargin()(Code)
Returns the left margin. the left margin



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



open
public void open()(Code)
Opens the document.

Once the document is opened, you can't write any Header- or Meta-information anymore. You have to open the document before you can begin to add content to the body of the document.




removeDocListener
public void removeDocListener(DocListener listener)(Code)
Removes a DocListener from the Document.
Parameters:
  listener - the DocListener that has to be removed.



resetFooter
public void resetFooter()(Code)
Resets the footer of this document.



resetHeader
public void resetHeader()(Code)
Resets the header of this document.



resetPageCount
public void resetPageCount()(Code)
Sets the page number to 0.



right
public float right()(Code)
Returns the upper right x-coordinate. the upper right x-coordinate



right
public float right(float margin)(Code)
Returns the upper right x-coordinate, considering a given margin.
Parameters:
  margin - a margin the upper right x-coordinate



rightMargin
public float rightMargin()(Code)
Return the right margin. the right margin



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



setHtmlStyleClass
public void setHtmlStyleClass(String htmlStyleClass)(Code)
Adds a style class to the HTML body tag
Parameters:
  htmlStyleClass - the style class for the HTML body tag



setJavaScript_onLoad
public void setJavaScript_onLoad(String code)(Code)
Adds a JavaScript onLoad function to the HTML body tag
Parameters:
  code - the JavaScript code to be executed on load of the HTML page



setJavaScript_onUnLoad
public void setJavaScript_onUnLoad(String code)(Code)
Adds a JavaScript onUnLoad function to the HTML body tag
Parameters:
  code - the JavaScript code to be executed on unload of the HTML page



setMarginMirroring
public boolean setMarginMirroring(boolean marginMirroring)(Code)
Set the margin mirroring. It will mirror margins for odd/even pages.

Note: it will not work with Table .
Parameters:
  marginMirroring - true to mirror the margins always true




setMargins
public boolean setMargins(float marginLeft, float marginRight, float marginTop, float marginBottom)(Code)
Sets the margins.
Parameters:
  marginLeft - the margin on the left
Parameters:
  marginRight - the margin on the right
Parameters:
  marginTop - the margin on the top
Parameters:
  marginBottom - the margin on the bottom a boolean



setPageCount
public void setPageCount(int pageN)(Code)
Sets the page number.
Parameters:
  pageN - the new page number



setPageSize
public boolean setPageSize(Rectangle pageSize)(Code)
Sets the pagesize.
Parameters:
  pageSize - the new pagesize a boolean



top
public float top()(Code)
Returns the upper right y-coordinate. the upper right y-coordinate



top
public float top(float margin)(Code)
Returns the upper right y-coordinate, considering a given margin.
Parameters:
  margin - a margin the upper right y-coordinate



topMargin
public float topMargin()(Code)
Returns the top margin. the top margin



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.