Skip to main content

SignatureField Class

A signature form field in a PDF document.

Declaration

public class SignatureField extends FormField

Remarks

The following code snippet creates a signature field:

import com.devexpress.docs.pdf.*;
import com.devexpress.system.drawing.*;
import com.devexpress.drawing.printing.DXPaperKind;

import java.nio.channels.*;
import java.nio.file.*;

public class Main {
    public static void main(String[] args) throws Exception {
        try (PdfDocument pdfDocument = new PdfDocument()) {
            // Add an A4 page to the document.
            Page page = pdfDocument.getPages().add(DXPaperKind.A4);

            // Create a signature field.
            SignatureField field = new SignatureField("Signature");
            field.setShowDate(true);
            pdfDocument.getFields().add(field);

            // Bind the field to a widget.
            SignatureWidgetAnnotation widget =
                    new SignatureWidgetAnnotation(field, new RectangleF(20, 500, 180, 60));

            page.getAnnotations().add(widget);

            // Save the document.
            try (WritableByteChannel channel =
                     FileChannel.open(Path.of("result.pdf"),
                         StandardOpenOption.CREATE,
                         StandardOpenOption.WRITE,
                         StandardOpenOption.TRUNCATE_EXISTING)) {

                pdfDocument.save(channel);
            }
        }
    }
}

Refer to the following help topic for additional information: Create a Signature Field.

Inherited Members

com.devexpress.system.JavaObject.clone()
com.devexpress.system.JavaObject.equals(java.lang.Object)
com.devexpress.system.JavaObject.hashCode()
com.devexpress.system.JavaObject.initFields()
com.devexpress.system.JavaObject.memberwiseClone()
com.devexpress.system.JavaObject.toString()
java.lang.Object.finalize()
java.lang.Object.getClass()
java.lang.Object.notify()
java.lang.Object.notifyAll()
java.lang.Object.wait()
java.lang.Object.wait(long)
java.lang.Object.wait(long,int)

Inheritance

Object
JavaObject
FormField
SignatureField

SignatureField(String name)

Initializes a new instance of the SignatureField class with specified settings.

Declaration

public SignatureField(String name)

Parameters

Name Type Description
name String

The name of the signature field.

Methods

getContactInfo() Method

Returns the contact information displayed in the signature field.

Declaration

public String getContactInfo()

Returns

Type Description
String

The contact information displayed in the signature field.

getContentImage() Method

Returns the image displayed in the signature field.

Declaration

public DXImage getContentImage()

Returns

Type Description
DXImage

The image displayed in the signature field.

getIsSigned() Method

Returns whether the signature field is signed.

Declaration

public boolean getIsSigned()

Returns

Type Description
boolean

true if the signature field is signed; otherwise, false.

getLineAlignment() Method

Returns the alignment of text lines displayed in the signature field.

Declaration

public FormFieldTextAlignment getLineAlignment()

Returns

Type Description
FormFieldTextAlignment

The alignment of text lines displayed in the signature field.

getReason() Method

Returns the reason displayed in the signature field.

Declaration

public String getReason()

Returns

Type Description
String

The reason displayed in the signature field.

getShowDate() Method

Returns whether the signing date is displayed in the signature field.

Declaration

public boolean getShowDate()

Returns

Type Description
boolean

true if the signing date is displayed in the signature field; otherwise, false.

getShowLabels() Method

Returns whether labels are displayed in the signature field.

Declaration

public boolean getShowLabels()

Returns

Type Description
boolean

true if labels are displayed in the signature field; otherwise, false.

getShowLocation() Method

Returns whether the signing location is displayed in the signature field.

Declaration

public boolean getShowLocation()

Returns

Type Description
boolean

true if the signing location is displayed in the signature field; otherwise, false.

getShowReason() Method

Returns whether the signing reason is displayed in the signature field.

Declaration

public boolean getShowReason()

Returns

Type Description
boolean

true if the signing reason is displayed in the signature field; otherwise, false.

getShowSignerName() Method

Returns whether the signer name is displayed in the signature field.

Declaration

public boolean getShowSignerName()

Returns

Type Description
boolean

true if the signer name is displayed in the signature field; otherwise, false.

getSignerName() Method

Returns the signer name displayed in the signature field.

Declaration

public String getSignerName()

Returns

Type Description
String

The signer name displayed in the signature field.

getSigningTime() Method

Returns the signing time.

Declaration

public OffsetDateTime getSigningTime()

Returns

Type Description
OffsetDateTime

The signing time, if the signature field is signed.

getStretchContentImage() Method

Returns whether the image is stretched to fit the signature field.

Declaration

public boolean getStretchContentImage()

Returns

Type Description
boolean

true if the image is stretched to fit the signature field; otherwise, false.

getText() Method

Returns a custom text displayed in the signature field.

Declaration

public String getText()

Returns

Type Description
String

The custom text displayed in the signature field.

setContentImage(DXImage value) Method

Sets the image displayed in the signature field.

Declaration

public void setContentImage(DXImage value)

Parameters

Name Type Description
value DXImage

The image displayed in the signature field.

setLineAlignment(FormFieldTextAlignment value) Method

Sets the alignment of text lines displayed in the signature field.

Declaration

public void setLineAlignment(FormFieldTextAlignment value)

Parameters

Name Type Description
value FormFieldTextAlignment

The alignment of text lines displayed in the signature field.

setShowDate(boolean value) Method

Sets whether to display the signing date in the signature field.

Declaration

public void setShowDate(boolean value)

Parameters

Name Type Description
value boolean

true to display the signing date in the signature field; otherwise, false.

setShowLabels(boolean value) Method

Sets whether to display labels in the signature field.

Declaration

public void setShowLabels(boolean value)

Parameters

Name Type Description
value boolean

true to display labels in the signature field; otherwise, false.

setShowLocation(boolean value) Method

Sets whether to display the signing location in the signature field.

Declaration

public void setShowLocation(boolean value)

Parameters

Name Type Description
value boolean

true to display the signing location in the signature field; otherwise, false.

setShowReason(boolean value) Method

Sets whether to display the signing reason in the signature field.

Declaration

public void setShowReason(boolean value)

Parameters

Name Type Description
value boolean

true to display the signing reason in the signature field; otherwise, false.

setShowSignerName(boolean value) Method

Sets whether to display the signer name in the signature field.

Declaration

public void setShowSignerName(boolean value)

Parameters

Name Type Description
value boolean

true to display the signer name in the signature field; otherwise, false.

setStretchContentImage(boolean value) Method

Sets whether to stretch the image to fit the signature field.

Declaration

public void setStretchContentImage(boolean value)

Parameters

Name Type Description
value boolean

true to stretch the image to fit the signature field; otherwise, false.

setText(String value) Method

Sets a custom text displayed in the signature field.

Declaration

public void setText(String value)

Parameters

Name Type Description
value String

The custom text displayed in the signature field.