TX Text Control .NET Server

Add Method

Method|Introduced in 31.0
Namespace
TXTextControl
Package
TXTextControl.TextControl.Core.SDK as TXTextControl.Core.dll from the private NuGet feed or Text Control Offline Packages
Also in
TXTextControl.TextControl.ASP.SDK as TXTextControl.dll

Description

Inserts a new signature field in a Text Control document.

Syntax

Add(SignatureField, int)

Inserts a signature field inline, which means that it is treated in the text like a single character. The field is inserted at the specified text position.

public bool Add(SignatureField signatureField, int textPosition);
ParameterDescription
signatureField

Specifies the signature field to add.

textPosition

Specifies the text position at which the signature field is to be inserted. If -1 is specified, the signature field is inserted at the current input position.

Add(SignatureField, HorizontalAlignment, int, FrameInsertionMode)

Inserts a signature field which is anchored to the paragraph containing the specified text position. The field has the specified horizontal alignment. FrameInsertionMode.FixedOnPage and FrameInsertionMode.AsCharacter cannot be specified with this overload.

public bool Add(SignatureField signatureField, HorizontalAlignment alignment, int textPosition, FrameInsertionMode insertionMode);
ParameterDescription
signatureField

Specifies the signature field to add.

alignment

Specifies the signature field's horizontal alignment. It can be one of the HorizontalAlignment values:

ValueMeaning
LeftThe signature field is left aligned relative to the paragraph to which it is anchored.
RightThe signature field is right aligned relative to the paragraph to which it is anchored.
CenteredThe signature field is centered relative to the paragraph to which it is anchored.
JustifyThis value is not possible for the alignment of signature fields.
textPosition

Specifies the text position at which the signature field is to be inserted. If -1 is specified, the signature field is inserted at the current input position.

insertionMode

Specifies how the text flow is handled. It can be one of the values of the FrameInsertionMode enumeration.

Add(SignatureField, Point, int, FrameInsertionMode)

Inserts a signature field which is anchored to the paragraph containing the specified text position. The field has the specified position relative to the paragraph containing its anchor position. FrameInsertionMode.FixedOnPage and FrameInsertionMode.AsCharacter cannot be specified with this overload.

public bool Add(SignatureField signatureField, Point location, int textPosition, FrameInsertionMode insertionMode);
ParameterDescription
signatureField

Specifies the signature field to add.

location

Specifies the location, in twips, at which the signature field is to be inserted. This is a location relative to the top left corner either of a page or of a paragraph.

textPosition

Specifies the text position at which the signature field is to be inserted. If -1 is specified, the signature field is inserted at the current input position.

insertionMode

Specifies how the text flow is handled. It can be one of the values of the FrameInsertionMode enumeration.

Add(SignatureField, int, Point, FrameInsertionMode)

Inserts a signature field that has a fixed geometrical position in the document. This position is specified through a page number and a location on this page. FrameInsertionMode.MoveWithText and FrameInsertionMode.AsCharacter cannot be specified with this overload.

public bool Add(SignatureField signatureField, int pageNumber, Point location, FrameInsertionMode insertionMode);
ParameterDescription
signatureField

Specifies the signature field to add.

pageNumber

Specifies the number of a page beginning with 1 where the signature field is located.

location

Specifies the location, in twips, at which the signature field is to be inserted. This is a location relative to the top left corner either of a page or of a paragraph.

insertionMode

Specifies how the text flow is handled. It can be one of the values of the FrameInsertionMode enumeration.

Add(SignatureField, Point, FrameInsertionMode)

Inserts a signature field that has a fixed geometrical position in the document. This location is specified through a document position relative to the top left corner of the complete document. FrameInsertionMode.MoveWithText and FrameInsertionMode.AsCharacter cannot be specified with this overload.

public bool Add(SignatureField signatureField, Point location, FrameInsertionMode insertionMode);
ParameterDescription
signatureField

Specifies the signature field to add.

location

Specifies the location, in twips, at which the signature field is to be inserted. This is a location relative to the top left corner either of a page or of a paragraph.

insertionMode

Specifies how the text flow is handled. It can be one of the values of the FrameInsertionMode enumeration.

Add(SignatureField, FrameInsertionMode)

Inserts a signature field with the built-in mouse interface. The signature field's size is determined through the end-user. A cross cursor indicates where the signature field can be inserted. Changing the document or pressing the ESC key aborts the insertion process.

public bool Add(SignatureField signatureField, FrameInsertionMode insertionMode);
ParameterDescription
signatureField

Specifies the signature field to add.

insertionMode

Specifies how the text flow is handled. It can be one of the values of the FrameInsertionMode enumeration.

Return Value

The return value is true, if the signature field could be added. Otherwise, it is false.

Examples

The following example works with signature fields in the current document by using SignatureFieldCollection.Add.

SignatureFieldCollection signatureFieldCollection = textControl.SignatureFields;

if (!signatureFieldCollection.Add(new SignatureField(new System.Drawing.Size(600, 400), "CustomerName", 100), -1))
{
    throw new InvalidOperationException("The item could not be inserted.");
}