C# Class iTextSharp.text.Document

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.

  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.
Inheritance: IDocListener
Exibir arquivo Open project: mapo80/iTextSharp-Monotouch Class Usage Examples

Public Properties

Property Type Description
Compress bool
WmfFontCorrection float

Protected Properties

Property Type Description
chapternumber int
close bool
htmlStyleClass string
javaScript_onLoad string
javaScript_onUnLoad string
listeners List
marginBottom float
marginLeft float
marginMirroring bool
marginMirroringTopBottom bool
marginRight float
marginTop float
open bool
pageN int
pageSize Rectangle

Public Methods

Method Description
Add ( IElement element ) : bool

Adds an Element to the Document.

AddAuthor ( string author ) : bool

Adds the author to a Document.

AddCreationDate ( ) : bool

Adds the current date and time to a Document.

AddCreator ( string creator ) : bool

Adds the creator to a Document.

AddDocListener ( IDocListener listener ) : void

Adds a IDocListener to the Document.

AddHeader ( string name, string content ) : bool

Adds a user defined header to the document.

AddKeywords ( string keywords ) : bool

Adds the keywords to a Document.

AddProducer ( ) : bool

Adds the producer to a Document.

AddSubject ( string subject ) : bool

Adds the subject to a Document.

AddTitle ( string title ) : bool

Adds the title to a Document.

Close ( ) : void

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.

CloseDocument ( ) : void

Closes the document.

Version for languages that are not case-dependant. 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.

Dispose ( ) : void
Document ( ) : System

Constructs a new Document-object.

Document ( Rectangle pageSize ) : System

Constructs a new Document-object.

Document ( Rectangle pageSize, float marginLeft, float marginRight, float marginTop, float marginBottom ) : System

Constructs a new Document-object.

GetBottom ( float margin ) : float

Returns the lower left y-coordinate, considering a given margin.

GetLeft ( float margin ) : float

Returns the lower left x-coordinate considering a given margin.

GetRight ( float margin ) : float

Returns the upper right x-coordinate, considering a given margin.

GetTop ( float margin ) : float

Returns the upper right y-coordinate, considering a given margin.

IsMarginMirroring ( ) : bool
IsOpen ( ) : bool

Checks if the document is open.

NewPage ( ) : bool

Signals that an new page has to be started.

Open ( ) : void

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.

OpenDocument ( ) : void

Opens the document.

Version for languages that are not case-dependant. 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.

RemoveIDocListener ( IDocListener listener ) : void

Removes a IDocListener from the Document.

ResetPageCount ( ) : void

Sets the page number to 0.

SetMarginMirroring ( bool marginMirroring ) : bool
SetMarginMirroringTopBottom ( bool marginMirroringTopBottom ) : bool
SetMargins ( float marginLeft, float marginRight, float marginTop, float marginBottom ) : bool

Sets the margins.

SetPageSize ( Rectangle pageSize ) : bool

Sets the pagesize.

Method Details

Add() public method

Adds an Element to the Document.
public Add ( IElement element ) : bool
element IElement the Element to add
return bool

AddAuthor() public method

Adds the author to a Document.
public AddAuthor ( string author ) : bool
author string the name of the author
return bool

AddCreationDate() public method

Adds the current date and time to a Document.
public AddCreationDate ( ) : bool
return bool

AddCreator() public method

Adds the creator to a Document.
public AddCreator ( string creator ) : bool
creator string the name of the creator
return bool

AddDocListener() public method

Adds a IDocListener to the Document.
public AddDocListener ( IDocListener listener ) : void
listener IDocListener the new IDocListener
return void

AddHeader() public method

Adds a user defined header to the document.
public AddHeader ( string name, string content ) : bool
name string the name of the header
content string the content of the header
return bool

AddKeywords() public method

Adds the keywords to a Document.
public AddKeywords ( string keywords ) : bool
keywords string keywords to add
return bool

AddProducer() public method

Adds the producer to a Document.
public AddProducer ( ) : bool
return bool

AddSubject() public method

Adds the subject to a Document.
public AddSubject ( string subject ) : bool
subject string the subject
return bool

AddTitle() public method

Adds the title to a Document.
public AddTitle ( string title ) : bool
title string the title
return bool

Close() public method

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.
public Close ( ) : void
return void

CloseDocument() public method

Closes the document.
Version for languages that are not case-dependant. 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.
public CloseDocument ( ) : void
return void

Dispose() public method

public Dispose ( ) : void
return void

Document() public method

Constructs a new Document-object.
public Document ( ) : System
return System

Document() public method

Constructs a new Document-object.
public Document ( Rectangle pageSize ) : System
pageSize Rectangle the pageSize
return System

Document() public method

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

GetBottom() public method

Returns the lower left y-coordinate, considering a given margin.
public GetBottom ( float margin ) : float
margin float a margin
return float

GetLeft() public method

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

GetRight() public method

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

GetTop() public method

Returns the upper right y-coordinate, considering a given margin.
public GetTop ( float margin ) : float
margin float a margin
return float

IsMarginMirroring() public method

public IsMarginMirroring ( ) : bool
return bool

IsOpen() public method

Checks if the document is open.
public IsOpen ( ) : bool
return bool

NewPage() public method

Signals that an new page has to be started.
public NewPage ( ) : bool
return bool

Open() public method

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.
public Open ( ) : void
return void

OpenDocument() public method

Opens the document.
Version for languages that are not case-dependant. 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.
public OpenDocument ( ) : void
return void

RemoveIDocListener() public method

Removes a IDocListener from the Document.
public RemoveIDocListener ( IDocListener listener ) : void
listener IDocListener the IDocListener that has to be removed.
return void

ResetPageCount() public method

Sets the page number to 0.
public ResetPageCount ( ) : void
return void

SetMarginMirroring() public method

public SetMarginMirroring ( bool marginMirroring ) : bool
marginMirroring bool
return bool

SetMarginMirroringTopBottom() public method

public SetMarginMirroringTopBottom ( bool marginMirroringTopBottom ) : bool
marginMirroringTopBottom bool
return bool

SetMargins() public method

Sets the margins.
public SetMargins ( float marginLeft, float marginRight, float marginTop, float marginBottom ) : bool
marginLeft float the margin on the left
marginRight float the margin on the right
marginTop float the margin on the top
marginBottom float the margin on the bottom
return bool

SetPageSize() public method

Sets the pagesize.
public SetPageSize ( Rectangle pageSize ) : bool
pageSize Rectangle the new pagesize
return bool

Property Details

Compress public_oe static_oe property

Allows the pdf documents to be produced without compression for debugging purposes.
public static bool Compress
return bool

WmfFontCorrection public_oe static_oe property

Scales the WMF font size. The default value is 0.86.
public static float WmfFontCorrection
return float

chapternumber protected_oe property

protected int chapternumber
return int

close protected_oe property

Has the document already been closed?
protected bool close
return bool

htmlStyleClass protected_oe property

Style class in HTML body tag
protected string htmlStyleClass
return string

javaScript_onLoad protected_oe property

Content of JavaScript onLoad function
protected string javaScript_onLoad
return string

javaScript_onUnLoad protected_oe property

Content of JavaScript onUnLoad function
protected string javaScript_onUnLoad
return string

listeners protected_oe property

The IDocListener.
protected List listeners
return List

marginBottom protected_oe property

margin in y direction starting from the bottom
protected float marginBottom
return float

marginLeft protected_oe property

margin in x direction starting from the left
protected float marginLeft
return float

marginMirroring protected_oe property

protected bool marginMirroring
return bool

marginMirroringTopBottom protected_oe property

protected bool marginMirroringTopBottom
return bool

marginRight protected_oe property

margin in x direction starting from the right
protected float marginRight
return float

marginTop protected_oe property

margin in y direction starting from the top
protected float marginTop
return float

open protected_oe property

Is the document open or not?
protected bool open
return bool

pageN protected_oe property

Current pagenumber
protected int pageN
return int

pageSize protected_oe property

The size of the page.
protected Rectangle,iTextSharp.text pageSize
return Rectangle