GdPicture.NET.14
GdPicture14 Namespace / GdPicturePDF Class / AddSignatureFormField Method
The horizontal (X) coordinate of the closest point to the currently defined origin, where the form field's bounding box is to be located. The value is expressed in the current units specified by the SetMeasurementUnit method and it is related to the current page. For further assistance, please see the Remarks section below.
The vertical (Y) coordinate of the closest point to the currently defined origin, where the form field's bounding box is to be located. The value is expressed in the current units specified by the SetMeasurementUnit method and it is related to the current page. For further assistance, please see the Remarks section below.
The width of the form field's bounding box, expressed in the current units specified by the SetMeasurementUnit method.
The height of the form field's bounding box, expressed in the current units specified by the SetMeasurementUnit method.
The name of the form field. It can be an empty string, but it is recommended to set a value.
Example





In This Topic
AddSignatureFormField Method (GdPicturePDF)
In This Topic
Adds an empty signature form field, so called signature placeholder, on the current page of loaded PDF document according to what you have specified. A signature field is intended to be used when digitally signing a document. For further assistance, please see the Digital Signature section of the GdPicturePDF class in the Reference Guide.

You can subsequently use other methods for assigning more form field properties.

Syntax
'Declaration
 
Public Function AddSignatureFormField( _
   ByVal Left As Single, _
   ByVal Top As Single, _
   ByVal Width As Single, _
   ByVal Height As Single, _
   ByVal FieldName As String _
) As Integer
public int AddSignatureFormField( 
   float Left,
   float Top,
   float Width,
   float Height,
   string FieldName
)
public function AddSignatureFormField( 
    Left: Single;
    Top: Single;
    Width: Single;
    Height: Single;
    FieldName: String
): Integer; 
public function AddSignatureFormField( 
   Left : float,
   Top : float,
   Width : float,
   Height : float,
   FieldName : String
) : int;
public: int AddSignatureFormField( 
   float Left,
   float Top,
   float Width,
   float Height,
   string* FieldName
) 
public:
int AddSignatureFormField( 
   float Left,
   float Top,
   float Width,
   float Height,
   String^ FieldName
) 

Parameters

Left
The horizontal (X) coordinate of the closest point to the currently defined origin, where the form field's bounding box is to be located. The value is expressed in the current units specified by the SetMeasurementUnit method and it is related to the current page. For further assistance, please see the Remarks section below.
Top
The vertical (Y) coordinate of the closest point to the currently defined origin, where the form field's bounding box is to be located. The value is expressed in the current units specified by the SetMeasurementUnit method and it is related to the current page. For further assistance, please see the Remarks section below.
Width
The width of the form field's bounding box, expressed in the current units specified by the SetMeasurementUnit method.
Height
The height of the form field's bounding box, expressed in the current units specified by the SetMeasurementUnit method.
FieldName
The name of the form field. It can be an empty string, but it is recommended to set a value.

Return Value

The unique identifier of the newly created empty signature form field. The GetStat method can be subsequently used to determine if this method has been successful.
Remarks
This method is only allowed for use with non-encrypted documents.

It is recommend to use the GetStat method to identify the specific reason for the method's failure, if any.

Please always ensure that you have selected the correct page using the SelectPage method before adding a required form field.

You also need to be aware that the values of coordinates and dimensions are expressed in the current units defined by the SetMeasurementUnit method according to the current coordinate space defined by the SetOrigin method.

Example
How to add an empty (unsigned) signature form field to the PDF document.
Dim caption As String = "AddSignatureFormField"
Dim gdpicturePDF As New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.NewPDF()
If status = GdPictureStatus.OK Then
    Dim fontResName As String = gdpicturePDF.AddStandardFont(PdfStandardFont.PdfStandardFontHelvetica)
    status = gdpicturePDF.GetStat()
    If status = GdPictureStatus.OK Then
        If (gdpicturePDF.NewPage(PdfPageSizes.PdfPageSizeA4) = GdPictureStatus.OK) AndAlso
           (gdpicturePDF.DrawRectangle(300, 100, 200, 50, False, True) = GdPictureStatus.OK) AndAlso
           (gdpicturePDF.DrawText(fontResName, 320, 80, "Apply your signature here.") = GdPictureStatus.OK) Then
            Dim signatureID As Integer = gdpicturePDF.AddSignatureFormField(300, 100, 200, 50, "Signature1")
            status = gdpicturePDF.GetStat()
            If status = GdPictureStatus.OK Then
                status = gdpicturePDF.SaveToFile("test_AddSignatureFormField.pdf")
                If status = GdPictureStatus.OK Then
                    MessageBox.Show("The signature field with the index " + signatureID.ToString() + " has been added successfully and the file has been saved.", caption)
                Else
                    MessageBox.Show("The method SaveToFile() has failed with the status: " + status.ToString(), caption)
                End If
            Else
                MessageBox.Show("The method AddSignatureFormField() has failed with the status: " + status.ToString(), caption)
            End If
        Else
            MessageBox.Show("The NewPage() method or one of the Draw... methods has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption)
        End If
    Else
        MessageBox.Show("The method AddStandardFont() has failed with the status: " + status.ToString(), caption)
    End If
Else
    MessageBox.Show("The method NewPDF() has failed with the status: " + status.ToString(), caption)
End If
gdpicturePDF.Dispose()
string caption = "AddSignatureFormField";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
GdPictureStatus status = gdpicturePDF.NewPDF();
if (status == GdPictureStatus.OK)
{
    string fontResName = gdpicturePDF.AddStandardFont(PdfStandardFont.PdfStandardFontHelvetica);
    status = gdpicturePDF.GetStat();
    if (status == GdPictureStatus.OK)
    {
        if ((gdpicturePDF.NewPage(PdfPageSizes.PdfPageSizeA4) == GdPictureStatus.OK) &&
            (gdpicturePDF.DrawRectangle(300, 100, 200, 50, false, true) == GdPictureStatus.OK) &&
            (gdpicturePDF.DrawText(fontResName, 320, 80, "Apply your signature here.") == GdPictureStatus.OK))
        {
            int signatureID = gdpicturePDF.AddSignatureFormField(300, 100, 200, 50, "Signature1");
            status = gdpicturePDF.GetStat();
            if (status == GdPictureStatus.OK)
            {
                status = gdpicturePDF.SaveToFile("test_AddSignatureFormField.pdf");
                if (status == GdPictureStatus.OK)
                    MessageBox.Show("The signature field with the index " + signatureID.ToString() + " has been added successfully and the file has been saved.", caption);
                else
                    MessageBox.Show("The method SaveToFile() has failed with the status: " + status.ToString(), caption);
            }
            else
            {
                MessageBox.Show("The method AddSignatureFormField() has failed with the status: " + status.ToString(), caption);
            }
        }
        else
        {
            MessageBox.Show("The NewPage() method or one of the Draw... methods has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption);
        }
    }
    else
    {
        MessageBox.Show("The method AddStandardFont() has failed with the status: " + status.ToString(), caption);
    }
}
else
{
    MessageBox.Show("The method NewPDF() has failed with the status: " + status.ToString(), caption);
}
gdpicturePDF.Dispose();
See Also