GdPicture.NET.14.API
GdPicture14 Namespace / GdPicturePDF Class / SetSignaturePosFromPlaceHolder Method / SetSignaturePosFromPlaceHolder(Int32) Method
The index of the signature form field (placeholder). It must be a value from 0 to GdPicturePDF.GetSignatureCount-1 related to the document, where the placeholder is located. Be aware that this index doesn't correspond to the form field unique identifier.
Example





In This Topic
SetSignaturePosFromPlaceHolder(Int32) Method
In This Topic
Sets up the coordinates and dimensions of the signature's bounding box within the current page of the loaded PDF document. This is the location, where the signature is placed after the successful signing of the current document. This method uses an empty signature form field specified by its index, so called signature placeholder, previously added by GdPicturePDF.AddSignatureFormField method, to inherit its coordinates and dimensions. If you omit this method in the signing process, or the width or the height of a placeholder are set to 0, the signature will not be drawn, that means it becomes invisible on the current page.
Syntax
'Declaration
 
Public Overloads Function SetSignaturePosFromPlaceHolder( _
   ByVal SignatureIdx As Integer _
) As GdPictureStatus
public GdPictureStatus SetSignaturePosFromPlaceHolder( 
   int SignatureIdx
)
public function SetSignaturePosFromPlaceHolder( 
    SignatureIdx: Integer
): GdPictureStatus; 
public function SetSignaturePosFromPlaceHolder( 
   SignatureIdx : int
) : GdPictureStatus;
public: GdPictureStatus SetSignaturePosFromPlaceHolder( 
   int SignatureIdx
) 
public:
GdPictureStatus SetSignaturePosFromPlaceHolder( 
   int SignatureIdx
) 

Parameters

SignatureIdx
The index of the signature form field (placeholder). It must be a value from 0 to GdPicturePDF.GetSignatureCount-1 related to the document, where the placeholder is located. Be aware that this index doesn't correspond to the form field unique identifier.

Return Value

A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK.

We strongly recommend always checking this status first.

Remarks
This method is only allowed for use with non-encrypted documents.

Just to remind you that if you want to apply the defined settings during the signing, you need to set up the required parameters before you start the signing process. But using this method in the whole process is optional.

This method can be used instead of the GdPicturePDF.SetSignaturePos method. A signature place holder can be created with the GdPicturePDF.AddSignatureFormField method.

This method requires the Digital Signatures component to run.

Example
How to set the signature's location on the current page using an empty signature form field. You can find the complete sample within the ApplySignature() method's example.
Dim caption As String = "SetSignaturePosFromPlaceHolder"
Dim gdpicturePDF As New GdPicturePDF()
            
'Please take a PDF document created in the example for the AddSignatureFormField() method.
Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile("test_AddSignatureFormField.pdf", False)
If status <> GdPictureStatus.OK Then
    MessageBox.Show("The file can't be loaded.", caption)
    GoTo [error]
End If
            
'Please set the corresponding certificate - this is a mandatory step.
            
'Set the signature information. At least one parameter must be defined for the successful signing.
status = gdpicturePDF.SetSignatureInfo("Orpalis", "GdPicturePDF", "Toulouse (France)", "")
If status <> GdPictureStatus.OK Then
    MessageBox.Show("The method SetSignatureInfo() has failed with the status " + status.ToString(), caption)
    GoTo [error]
End If
            
'Find a placeholder for a signature.
Dim signatureCount As Integer = gdpicturePDF.GetSignatureCount()
'This step is strongly bound to the file "test_AddSignatureFormField.pdf".
If (gdpicturePDF.GetStat() = GdPictureStatus.OK) AndAlso (signatureCount = 1) Then
    'Set the signature's location on the current page. This step is optional.
    'If this step is omitted, the signature will be invisible.
    status = gdpicturePDF.SetSignaturePosFromPlaceHolder(signatureCount - 1)
    If status <> GdPictureStatus.OK Then
        MessageBox.Show("The method SetSignaturePosFromPlaceHolder() has failed with the status: " + status.ToString(), caption)
        GoTo [error]
    End If
Else
    MessageBox.Show("Can't find a signature placeholder field." + gdpicturePDF.GetStat().ToString(), caption)
    GoTo [error]
End If
            
'Please see the complete sample in the ApplySignature() method for next steps to follow.
            
[error]:
gdpicturePDF.Dispose()
string caption = "SetSignaturePosFromPlaceHolder";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
            
//Please take a PDF document created in the example for the AddSignatureFormField() method.
GdPictureStatus status = gdpicturePDF.LoadFromFile("test_AddSignatureFormField.pdf", false);
if (status != GdPictureStatus.OK)
{
    MessageBox.Show("The file can't be loaded.", caption);
    goto error;
}
            
//Please set the corresponding certificate - this is a mandatory step.
            
//Set the signature information. At least one parameter must be defined for the successful signing.
status = gdpicturePDF.SetSignatureInfo("Orpalis", "GdPicturePDF", "Toulouse (France)", "");
if (status != GdPictureStatus.OK)
{
    MessageBox.Show("The method SetSignatureInfo() has failed with the status " + status.ToString(), caption);
    goto error;
}
            
//Find a placeholder for a signature.
int signatureCount = gdpicturePDF.GetSignatureCount();
//This step is strongly bound to the file "test_AddSignatureFormField.pdf".
if ((gdpicturePDF.GetStat() == GdPictureStatus.OK) && (signatureCount == 1))
{
    //Set the signature's location on the current page. This step is optional.
    //If this step is omitted, the signature will be invisible.
    status = gdpicturePDF.SetSignaturePosFromPlaceHolder(signatureCount - 1);
    if (status != GdPictureStatus.OK)
    {
        MessageBox.Show("The method SetSignaturePosFromPlaceHolder() has failed with the status: " + status.ToString(), caption);
        goto error;
    }
}
else
{
    MessageBox.Show("Can't find a signature placeholder field." + gdpicturePDF.GetStat().ToString(), caption);
    goto error;
}
            
//Please see the complete sample in the ApplySignature() method for next steps to follow
            
error:
gdpicturePDF.Dispose();
See Also