C# Класс 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.
Наследование: IDocListener
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
Compress bool
WmfFontCorrection float

Защищенные свойства (Protected)

Свойство Тип Описание
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

Открытые методы

Метод Описание
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.

Описание методов

Add() публичный Метод

Adds an Element to the Document.
public Add ( IElement element ) : bool
element IElement the Element to add
Результат bool

AddAuthor() публичный Метод

Adds the author to a Document.
public AddAuthor ( string author ) : bool
author string the name of the author
Результат bool

AddCreationDate() публичный Метод

Adds the current date and time to a Document.
public AddCreationDate ( ) : bool
Результат bool

AddCreator() публичный Метод

Adds the creator to a Document.
public AddCreator ( string creator ) : bool
creator string the name of the creator
Результат bool

AddDocListener() публичный Метод

Adds a IDocListener to the Document.
public AddDocListener ( IDocListener listener ) : void
listener IDocListener the new IDocListener
Результат void

AddHeader() публичный Метод

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
Результат bool

AddKeywords() публичный Метод

Adds the keywords to a Document.
public AddKeywords ( string keywords ) : bool
keywords string keywords to add
Результат bool

AddProducer() публичный Метод

Adds the producer to a Document.
public AddProducer ( ) : bool
Результат bool

AddSubject() публичный Метод

Adds the subject to a Document.
public AddSubject ( string subject ) : bool
subject string the subject
Результат bool

AddTitle() публичный Метод

Adds the title to a Document.
public AddTitle ( string title ) : bool
title string the title
Результат bool

Close() публичный Метод

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
Результат void

CloseDocument() публичный Метод

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
Результат void

Dispose() публичный Метод

public Dispose ( ) : void
Результат void

Document() публичный Метод

Constructs a new Document-object.
public Document ( ) : System
Результат System

Document() публичный Метод

Constructs a new Document-object.
public Document ( Rectangle pageSize ) : System
pageSize Rectangle the pageSize
Результат System

Document() публичный Метод

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
Результат System

GetBottom() публичный Метод

Returns the lower left y-coordinate, considering a given margin.
public GetBottom ( float margin ) : float
margin float a margin
Результат float

GetLeft() публичный Метод

Returns the lower left x-coordinate considering a given margin.
public GetLeft ( float margin ) : float
margin float a margin
Результат float

GetRight() публичный Метод

Returns the upper right x-coordinate, considering a given margin.
public GetRight ( float margin ) : float
margin float a margin
Результат float

GetTop() публичный Метод

Returns the upper right y-coordinate, considering a given margin.
public GetTop ( float margin ) : float
margin float a margin
Результат float

IsMarginMirroring() публичный Метод

public IsMarginMirroring ( ) : bool
Результат bool

IsOpen() публичный Метод

Checks if the document is open.
public IsOpen ( ) : bool
Результат bool

NewPage() публичный Метод

Signals that an new page has to be started.
public NewPage ( ) : bool
Результат bool

Open() публичный Метод

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
Результат void

OpenDocument() публичный Метод

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
Результат void

RemoveIDocListener() публичный Метод

Removes a IDocListener from the Document.
public RemoveIDocListener ( IDocListener listener ) : void
listener IDocListener the IDocListener that has to be removed.
Результат void

ResetPageCount() публичный Метод

Sets the page number to 0.
public ResetPageCount ( ) : void
Результат void

SetMarginMirroring() публичный Метод

public SetMarginMirroring ( bool marginMirroring ) : bool
marginMirroring bool
Результат bool

SetMarginMirroringTopBottom() публичный Метод

public SetMarginMirroringTopBottom ( bool marginMirroringTopBottom ) : bool
marginMirroringTopBottom bool
Результат bool

SetMargins() публичный Метод

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
Результат bool

SetPageSize() публичный Метод

Sets the pagesize.
public SetPageSize ( Rectangle pageSize ) : bool
pageSize Rectangle the new pagesize
Результат bool

Описание свойств

Compress публичное статическое свойство

Allows the pdf documents to be produced without compression for debugging purposes.
public static bool Compress
Результат bool

WmfFontCorrection публичное статическое свойство

Scales the WMF font size. The default value is 0.86.
public static float WmfFontCorrection
Результат float

chapternumber защищенное свойство

protected int chapternumber
Результат int

close защищенное свойство

Has the document already been closed?
protected bool close
Результат bool

htmlStyleClass защищенное свойство

Style class in HTML body tag
protected string htmlStyleClass
Результат string

javaScript_onLoad защищенное свойство

Content of JavaScript onLoad function
protected string javaScript_onLoad
Результат string

javaScript_onUnLoad защищенное свойство

Content of JavaScript onUnLoad function
protected string javaScript_onUnLoad
Результат string

listeners защищенное свойство

The IDocListener.
protected List listeners
Результат List

marginBottom защищенное свойство

margin in y direction starting from the bottom
protected float marginBottom
Результат float

marginLeft защищенное свойство

margin in x direction starting from the left
protected float marginLeft
Результат float

marginMirroring защищенное свойство

protected bool marginMirroring
Результат bool

marginMirroringTopBottom защищенное свойство

protected bool marginMirroringTopBottom
Результат bool

marginRight защищенное свойство

margin in x direction starting from the right
protected float marginRight
Результат float

marginTop защищенное свойство

margin in y direction starting from the top
protected float marginTop
Результат float

open защищенное свойство

Is the document open or not?
protected bool open
Результат bool

pageN защищенное свойство

Current pagenumber
protected int pageN
Результат int

pageSize защищенное свойство

The size of the page.
protected Rectangle,iTextSharp.text pageSize
Результат Rectangle