DigitalSignOptions class

DigitalSignOptions class

Represents the digital signature options.

Learn more

The DigitalSignOptions type exposes the following members:

Constructors

Constructor Description
init Initializes a new instance of the DigitalSignOptions class with default values.
init Initializes a new DigitalSignOptions instance with a certificate file.
init Initializes a new DigitalSignOptions instance with a certificate stream.
init Initializes a new instance of the DigitalSignOptions class with a certificate file and an appearance image file.
init Initializes a new instance of DigitalSignOptions with a certificate file and an appearance image stream.
init Initializes a new instance of DigitalSignOptions with a certificate stream and an appearance image file.
init Initializes a new DigitalSignOptions instance with a certificate stream and an appearance image stream.

Methods

Method Description
dispose Clears internal resources. (inherited from ImageSignOptions)
from_base64 Creates a new ImageSignOptions instance with a predefined image from a Base64 string. (inherited from ImageSignOptions)

Properties

Property Description
allow_expired The flag that allows signing with a certificate whose validity period has ended. The default value is False; signing with an expired certificate raises GroupDocsSignatureException and the document is not signed.
allow_not_yet_valid The flag that allows signing with a certificate whose validity period has not started yet. The default value is False; signing with such a certificate raises GroupDocsSignatureException and the document is not signed.
certificate_file_path The digital certificate file path.
certificate_stream The digital certificate stream. If this property is specified it is always used instead of CertificateFilePath.
contact The signature contact.
custom_sign_hash The custom hash signing function used to sign the document, allowing users to implement their own digital signing logic.
height The height of the signature area on the document page in measure units (pixels, percents, or millimeters; see MeasureType).
horizontal_alignment The horizontal alignment of the image on a document page.
left The left X position of the signature area on the document page in measure units (pixels, percents, or millimeters as defined by MeasureType.location_measure_type).
location The signature location.
location_measure_type The measure type (pixels, percents or millimeters) for the left and top properties.
margin The space that is specified by default between the image and document edges (applies when horizontal or vertical alignment is specified).
margin_measure_type The margin measurement type (pixels, percents or millimeters).
password The password of the digital certificate.
reason The reason of the signature.
rotation_angle The rotation angle clockwise.
signature The digital signature properties for the document. For PDF signing, advanced properties can be set using a PdfDigitalSignature instance.
size_measure_type The measure type (pixels, percents or millimeters) for Width and Height properties.
stretch The stretch mode on the document page.
top The top Y position of the signature area on the document page in measure units (pixels, percents, or millimeters; see MeasureType LocationMeasureType).
transparency The transparency of the digital signature, ranging from 0.0 to 1.0. Default is 0.
use_ltv The LTV (Long Term Validation) validation flag.
vertical_alignment The vertical alignment of the image on a document page.
visible The visibility of the signature.
width The width of the signature area on the document page in measure values (pixels, percents, or millimeters). The measurement unit is defined by MeasureType via the SizeMeasureType property.
xad_es_type The XAdES type. Default value is None (XAdES is off).
all_pages The signature will be placed on all document pages. (inherited from SignOptions)
appearance The additional signature appearance. (inherited from SignOptions)
border The border settings for the image signature. (inherited from ImageSignOptions)
document_type The document type of the signature options (DocumentType). (inherited from SignOptions)
extensions The signature extensions. (inherited from SignOptions)
hash_algorithm The hash algorithm to be used for cryptographic operations. Supported exclusively for digital signatures in PDF files. (inherited from SignOptions)
image_file_path The file path of the signature image, used only if image_stream is not specified. (inherited from ImageSignOptions)
image_stream The signature image stream. If specified, it is always used instead of ImageFilePath. (inherited from ImageSignOptions)
page_number The document page number for signing. (inherited from SignOptions)
pages_setup The options to specify pages to be signed. (inherited from SignOptions)
rectangle The rectangle of area to put the image on document. (inherited from ImageSignOptions)
shape_position The shape position defines where the shape should be presented in the document layout. Available only for Word documents. (inherited from ImageSignOptions)
signature_type The signature type (SignatureType). (inherited from SignOptions)
zorder The Z-order position of the text signature, which determines the display order of overlapping signatures. (inherited from SignOptions)

Example

from groupdocs.signature import Signature
from groupdocs.signature.options import DigitalSignOptions

def sign_with_digital_signature_advanced():
    with Signature("sample.pdf") as signature:
        # Pass the certificate and the appearance image to the constructor
        options = DigitalSignOptions("certificate.pfx", "signature.jpg")
        options.password = "1234567890"

        # Show the signature on the page, at this position and size
        options.visible = True
        options.left = 100
        options.top = 400
        options.width = 200
        options.height = 100

        # Information stored in the signature
        options.contact = "John Smith"
        options.reason = "Approval"
        options.location = "New York"

        result = signature.sign("signed_digital_advanced.pdf", options)
        print(f"Signed with {len(result.succeeded)} digital signature(s)")

if __name__ == "__main__":
    sign_with_digital_signature_advanced()

Guides

Task guides that use DigitalSignOptions:

See Also