Class PdfDocument
- Namespace
- iTextSharp.text.pdf
- Assembly
- iTextSharp.LGPLv2.Core.dll
PdfDocument is the class that is used by PdfWriter to translate a Document into a PDF with different pages. A PdfDocument always listens to a Document and adds the Pdf representation of every Element that is added to the Document . @see com.lowagie.text.Document @see com.lowagie.text.DocListener @see PdfWriter
public class PdfDocument : Document, IDocListener, IElementListener, IDisposable
- Inheritance
-
PdfDocument
- Implements
- Inherited Members
Fields
AdditionalActions
protected PdfDictionary AdditionalActions
Field Value
Alignment
This represents the current alignment of the PDF Elements.
protected int Alignment
Field Value
AnchorAction
The current active PdfAction when processing an Anchor .
protected PdfAction AnchorAction
Field Value
BoxSize
This is the size of the several boxes that will be used in the next page.
protected INullValueDictionary<string, PdfRectangle> BoxSize
Field Value
CurrentOutline
This is the current PdfOutline in the hierarchy of outlines.
protected PdfOutline CurrentOutline
Field Value
DocumentFileAttachment
protected INullValueDictionary<string, PdfObject> DocumentFileAttachment
Field Value
DocumentLevelJs
protected INullValueDictionary<string, PdfObject> DocumentLevelJs
Field Value
FirstPageEvent
Signals that OnOpenDocument should be called.
protected bool FirstPageEvent
Field Value
Graphics
This is the PdfContentByte object, containing the borders and other Graphics.
protected PdfContentByte Graphics
Field Value
ImageEnd
This is the position where the image ends.
protected float ImageEnd
Field Value
ImageWait
This is the image that could not be shown on a previous page.
protected Image ImageWait
Field Value
IsSectionTitle
Signals that onParagraph is valid (to avoid that a Chapter/Section title is treated as a Paragraph). @since 2.1.2
protected bool IsSectionTitle
Field Value
LastElementType
Holds the type of the last element, that has been added to the document.
protected int LastElementType
Field Value
LeadingCount
Signals that the current leading has to be subtracted from a YMark object. @since 2.1.2
protected int LeadingCount
Field Value
Line
The line that is currently being written.
protected PdfLine Line
Field Value
Lines
The lines that are written until now.
protected IList<PdfLine> Lines
Field Value
LocalDestinations
Stores the destinations keyed by name. Value is Object[]{PdfAction,PdfIndirectReference,PdfDestintion} .
protected OrderedTree LocalDestinations
Field Value
MarkPoint
protected int MarkPoint
Field Value
NextMarginBottom
margin in y direction starting from the bottom. Will be valid in the next page
protected float NextMarginBottom
Field Value
NextMarginLeft
margin in x direction starting from the left. Will be valid in the next page
protected float NextMarginLeft
Field Value
NextMarginRight
margin in x direction starting from the right. Will be valid in the next page
protected float NextMarginRight
Field Value
NextMarginTop
margin in y direction starting from the top. Will be valid in the next page
protected float NextMarginTop
Field Value
NextPageSize
This is the size of the next page.
protected Rectangle NextPageSize
Field Value
OpenActionAction
protected PdfAction OpenActionAction
Field Value
OpenActionName
protected string OpenActionName
Field Value
PageAa
protected PdfDictionary PageAa
Field Value
Text
This is the PdfContentByte object, containing the text.
protected PdfContentByte Text
Field Value
TextEmptySize
protected int TextEmptySize
Field Value
ThisBoxSize
[U1] page sizes
protected INullValueDictionary<string, PdfRectangle> ThisBoxSize
Field Value
Thumb
protected PdfIndirectReference Thumb
Field Value
Writer
The PdfWriter .
protected PdfWriter Writer
Field Value
collection
protected PdfCollection collection
Field Value
duration
The duration of the page
protected int duration
Field Value
indentation
protected PdfDocument.Indentation indentation
Field Value
info
some meta information about the Document.
protected PdfDocument.PdfInfo info
Field Value
leading
This represents the leading of the lines.
protected float leading
Field Value
pageEmpty
This checks if the page is empty.
protected bool pageEmpty
Field Value
pageLabels
protected PdfPageLabels pageLabels
Field Value
pageResources
This are the page resources of the current Page.
protected PageResources pageResources
Field Value
rootOutline
This is the root outline of the document.
protected PdfOutline rootOutline
Field Value
strictImageSequence
Holds value of property strictImageSequence.
protected bool strictImageSequence
Field Value
transition
The page transition
protected PdfTransition transition
Field Value
viewerPreferences
Contains the Viewer preferences of this PDF document.
protected PdfViewerPreferencesImp viewerPreferences
Field Value
xmpMetadata
[L3] DocListener interface
protected byte[] xmpMetadata
Field Value
- byte[]
Properties
AcroForm
[C8] AcroForm
public PdfAcroForm AcroForm { get; }
Property Value
- PdfAcroForm
the PdfAcroform object of the PdfDocument
Collection
Sets the collection dictionary.
public PdfCollection Collection { set; }
Property Value
CurrentHeight
This is the current height of the document.
public float CurrentHeight { get; }
Property Value
Footer
Changes the footer of this document.
public override HeaderFooter Footer { set; }
Property Value
Header
Changes the header of this document.
public override HeaderFooter Header { set; }
Property Value
IndentBottom
protected float IndentBottom { get; }
Property Value
IndentLeft
protected float IndentLeft { get; }
Property Value
IndentRight
protected float IndentRight { get; }
Property Value
IndentTop
protected float IndentTop { get; }
Property Value
Leading
[L0] ElementListener interface
public float Leading { get; set; }
Property Value
- float
the current leading
PageCount
Sets the page number.
public override int PageCount { set; }
Property Value
RootOutline
Gets the root outline. All the outlines must be created with a parent. The first level is created with this outline.
public PdfOutline RootOutline { get; }
Property Value
- PdfOutline
the root outline
XmpMetadata
Use this method to set the XMP Metadata.
public byte[] XmpMetadata { set; }
Property Value
- byte[]
Methods
Add(IElement)
LISTENER METHODS START
public override bool Add(IElement element)
Parameters
element
IElementthe element to add
Returns
- bool
true if the element was added, false if not.
Add(Image)
Adds an image to the document. @throws PdfException on error @throws DocumentException on error
protected void Add(Image image)
Parameters
image
Imagethe Image to add
AddSpacing(float, float, Font)
Gets the indentation on the left side.
protected void AddSpacing(float extraspace, float oldleading, Font f)
Parameters
AnalyzeRow(IList<IList<PdfCell>>, RenderingContext)
protected void AnalyzeRow(IList<IList<PdfCell>> rows, PdfDocument.RenderingContext ctx)
Parameters
rows
IList<IList<PdfCell>>ctx
PdfDocument.RenderingContext
CarriageReturn()
protected void CarriageReturn()
ClearTextWrap()
Method added by Pelikan Stephan @see com.lowagie.text.DocListener#clearTextWrap()
public void ClearTextWrap()
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 override void Close()
ConsumeRowspan(IList<PdfCell>, RenderingContext)
protected static void ConsumeRowspan(IList<PdfCell> row, PdfDocument.RenderingContext ctx)
Parameters
row
IList<PdfCell>ctx
PdfDocument.RenderingContext
DoFooter()
[M5] header/footer
protected void DoFooter()
DoHeader()
protected void DoHeader()
EnsureNewLine()
If the current line is not empty or null, it is added to the arraylist of lines and a new empty line is added. @throws DocumentException on error
protected void EnsureNewLine()
ExtractRows(IList<PdfCell>, RenderingContext)
protected static IList<IList<PdfCell>> ExtractRows(IList<PdfCell> cells, PdfDocument.RenderingContext ctx)
Parameters
cells
IList<PdfCell>ctx
PdfDocument.RenderingContext
Returns
FlushLines()
Writes all the lines to the text-object. @throws DocumentException on error
protected float FlushLines()
Returns
- float
the displacement that was caused
GetVerticalPosition(bool)
Gets the current vertical page position. for elements that do not terminate the lines they've started because those lines will get terminated.
public float GetVerticalPosition(bool ensureNewLine)
Parameters
ensureNewLine
boolTells whether a new line shall be enforced. This may cause side effects
Returns
- float
The current vertical page position.
InitPage()
protected void InitPage()
MayBeRemoved(IList<PdfCell>)
protected static bool MayBeRemoved(IList<PdfCell> row)
Parameters
Returns
NewLine()
protected void NewLine()
NewPage()
[L2] DocListener interface
public override bool NewPage()
Returns
- bool
a bool
Open()
Opens the document. You have to open the document before you can begin to add content to the body of the document.
public override void Open()
RenderCells(RenderingContext, IList<PdfCell>, bool)
protected void RenderCells(PdfDocument.RenderingContext ctx, IList<PdfCell> cells, bool hasToFit)
Parameters
ctx
PdfDocument.RenderingContextcells
IList<PdfCell>hasToFit
bool
ResetFooter()
Resets the footer of this document.
public override void ResetFooter()
ResetHeader()
Resets the header of this document.
public override void ResetHeader()
ResetPageCount()
Sets the page number to 0.
public override void ResetPageCount()
SetMarginMirroring(bool)
@see com.lowagie.text.DocListener#setMarginMirroring(bool)
public override bool SetMarginMirroring(bool marginMirroring)
Parameters
marginMirroring
bool
Returns
SetMarginMirroringTopBottom(bool)
[L6] DocListener interface
public override bool SetMarginMirroringTopBottom(bool marginMirroringTopBottom)
Parameters
marginMirroringTopBottom
bool
Returns
SetMargins(float, float, float, float)
Sets the margins.
public override bool SetMargins(float marginLeft, float marginRight, float marginTop, float marginBottom)
Parameters
marginLeft
floatthe margin on the left
marginRight
floatthe margin on the right
marginTop
floatthe margin on the top
marginBottom
floatthe margin on the bottom
Returns
- bool
a bool
SetNewPageSizeAndMargins()
protected void SetNewPageSizeAndMargins()
SetPageSize(Rectangle)
Sets the pagesize.
public override bool SetPageSize(Rectangle pageSize)
Parameters
pageSize
Rectanglethe new pagesize
Returns
- bool
true if the page size was set