public class SignatureLine
Example:
// Create a blank document and its DocumentBuilder
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// The SignatureLineOptions will contain all the data that the signature line will display
SignatureLineOptions options = new SignatureLineOptions();
{
options.setAllowComments(true);
options.setDefaultInstructions(true);
options.setEmail("john.doe@management.com");
options.setInstructions("Please sign here");
options.setShowDate(true);
options.setSigner("John Doe");
options.setSignerTitle("Senior Manager");
}
// Insert the signature line, applying our SignatureLineOptions
// We can control where the signature line will appear on the page using a combination of left/top indents and margin-relative positions
// Since we're placing the signature line at the bottom right of the page, we will need to use negative indents to move it into view
Shape shape = builder.insertSignatureLine(options, RelativeHorizontalPosition.RIGHT_MARGIN, -170.0, RelativeVerticalPosition.BOTTOM_MARGIN, -60.0, WrapType.NONE);
Assert.assertTrue(shape.isSignatureLine());
// The SignatureLine object is a member of the shape that contains it
SignatureLine signatureLine = shape.getSignatureLine();
Assert.assertEquals(signatureLine.getEmail(), "john.doe@management.com");
Assert.assertEquals(signatureLine.getSigner(), "John Doe");
Assert.assertEquals(signatureLine.getSignerTitle(), "Senior Manager");
Assert.assertEquals(signatureLine.getInstructions(), "Please sign here");
Assert.assertTrue(signatureLine.getShowDate());
Assert.assertTrue(signatureLine.getAllowComments());
Assert.assertTrue(signatureLine.getDefaultInstructions());
// We will be prompted to sign it when we open the document
Assert.assertFalse(signatureLine.isSigned());
// The object may be valid, but the signature itself isn't until it is signed
Assert.assertFalse(signatureLine.isValid());
doc.save(getArtifactsDir() + "Shape.SignatureLine.docx");
Property Getters/Setters Summary | ||
---|---|---|
boolean | getAllowComments() | |
void | setAllowComments(booleanvalue) | |
Gets or sets a value indicating that the signer can add comments in the Sign dialog. Default value for this property is false. | ||
boolean | getDefaultInstructions() | |
void | setDefaultInstructions(booleanvalue) | |
Gets or sets a value indicating that default instructions is shown in the Sign dialog. Default value for this property is true. | ||
java.lang.String | getEmail() | |
void | setEmail(java.lang.Stringvalue) | |
Gets or sets suggested signer's e-mail address. Default value for this property is empty string. | ||
java.util.UUID | getId() | |
void | setId(java.util.UUIDvalue) | |
Gets or sets identifier for this signature line.
This identifier can be associated with a digital signature, when signing document using |
||
java.lang.String | getInstructions() | |
void | setInstructions(java.lang.Stringvalue) | |
Gets or sets instructions to the signer that are displayed on signing the signature line.
This property is ignored if |
||
boolean | isSigned() | |
Indicates that signature line is signed by digital signature.
|
||
boolean | isValid() | |
Indicates that signature line is signed by digital signature and this digital signature is valid.
|
||
java.util.UUID | getProviderId() | |
void | setProviderId(java.util.UUIDvalue) | |
Gets or sets signature provider identifier for this signature line. Default value is "{00000000-0000-0000-0000-000000000000}". | ||
boolean | getShowDate() | |
void | setShowDate(booleanvalue) | |
Gets or sets a value indicating that sign date is shown in the signature line. Default value for this property is true. | ||
java.lang.String | getSigner() | |
void | setSigner(java.lang.Stringvalue) | |
Gets or sets suggested signer of the signature line. Default value for this property is empty string. | ||
java.lang.String | getSignerTitle() | |
void | setSignerTitle(java.lang.Stringvalue) | |
Gets or sets suggested signer's title (for example, Manager). Default value for this property is empty string. |
public boolean getAllowComments() / public void setAllowComments(boolean value)
Example:
Shows how to create a line for a signature and insert it into a document.// Create a blank document and its DocumentBuilder Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // The SignatureLineOptions will contain all the data that the signature line will display SignatureLineOptions options = new SignatureLineOptions(); { options.setAllowComments(true); options.setDefaultInstructions(true); options.setEmail("john.doe@management.com"); options.setInstructions("Please sign here"); options.setShowDate(true); options.setSigner("John Doe"); options.setSignerTitle("Senior Manager"); } // Insert the signature line, applying our SignatureLineOptions // We can control where the signature line will appear on the page using a combination of left/top indents and margin-relative positions // Since we're placing the signature line at the bottom right of the page, we will need to use negative indents to move it into view Shape shape = builder.insertSignatureLine(options, RelativeHorizontalPosition.RIGHT_MARGIN, -170.0, RelativeVerticalPosition.BOTTOM_MARGIN, -60.0, WrapType.NONE); Assert.assertTrue(shape.isSignatureLine()); // The SignatureLine object is a member of the shape that contains it SignatureLine signatureLine = shape.getSignatureLine(); Assert.assertEquals(signatureLine.getEmail(), "john.doe@management.com"); Assert.assertEquals(signatureLine.getSigner(), "John Doe"); Assert.assertEquals(signatureLine.getSignerTitle(), "Senior Manager"); Assert.assertEquals(signatureLine.getInstructions(), "Please sign here"); Assert.assertTrue(signatureLine.getShowDate()); Assert.assertTrue(signatureLine.getAllowComments()); Assert.assertTrue(signatureLine.getDefaultInstructions()); // We will be prompted to sign it when we open the document Assert.assertFalse(signatureLine.isSigned()); // The object may be valid, but the signature itself isn't until it is signed Assert.assertFalse(signatureLine.isValid()); doc.save(getArtifactsDir() + "Shape.SignatureLine.docx");
public boolean getDefaultInstructions() / public void setDefaultInstructions(boolean value)
Example:
Shows how to create a line for a signature and insert it into a document.// Create a blank document and its DocumentBuilder Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // The SignatureLineOptions will contain all the data that the signature line will display SignatureLineOptions options = new SignatureLineOptions(); { options.setAllowComments(true); options.setDefaultInstructions(true); options.setEmail("john.doe@management.com"); options.setInstructions("Please sign here"); options.setShowDate(true); options.setSigner("John Doe"); options.setSignerTitle("Senior Manager"); } // Insert the signature line, applying our SignatureLineOptions // We can control where the signature line will appear on the page using a combination of left/top indents and margin-relative positions // Since we're placing the signature line at the bottom right of the page, we will need to use negative indents to move it into view Shape shape = builder.insertSignatureLine(options, RelativeHorizontalPosition.RIGHT_MARGIN, -170.0, RelativeVerticalPosition.BOTTOM_MARGIN, -60.0, WrapType.NONE); Assert.assertTrue(shape.isSignatureLine()); // The SignatureLine object is a member of the shape that contains it SignatureLine signatureLine = shape.getSignatureLine(); Assert.assertEquals(signatureLine.getEmail(), "john.doe@management.com"); Assert.assertEquals(signatureLine.getSigner(), "John Doe"); Assert.assertEquals(signatureLine.getSignerTitle(), "Senior Manager"); Assert.assertEquals(signatureLine.getInstructions(), "Please sign here"); Assert.assertTrue(signatureLine.getShowDate()); Assert.assertTrue(signatureLine.getAllowComments()); Assert.assertTrue(signatureLine.getDefaultInstructions()); // We will be prompted to sign it when we open the document Assert.assertFalse(signatureLine.isSigned()); // The object may be valid, but the signature itself isn't until it is signed Assert.assertFalse(signatureLine.isValid()); doc.save(getArtifactsDir() + "Shape.SignatureLine.docx");
public java.lang.String getEmail() / public void setEmail(java.lang.String value)
Example:
Shows how to create a line for a signature and insert it into a document.// Create a blank document and its DocumentBuilder Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // The SignatureLineOptions will contain all the data that the signature line will display SignatureLineOptions options = new SignatureLineOptions(); { options.setAllowComments(true); options.setDefaultInstructions(true); options.setEmail("john.doe@management.com"); options.setInstructions("Please sign here"); options.setShowDate(true); options.setSigner("John Doe"); options.setSignerTitle("Senior Manager"); } // Insert the signature line, applying our SignatureLineOptions // We can control where the signature line will appear on the page using a combination of left/top indents and margin-relative positions // Since we're placing the signature line at the bottom right of the page, we will need to use negative indents to move it into view Shape shape = builder.insertSignatureLine(options, RelativeHorizontalPosition.RIGHT_MARGIN, -170.0, RelativeVerticalPosition.BOTTOM_MARGIN, -60.0, WrapType.NONE); Assert.assertTrue(shape.isSignatureLine()); // The SignatureLine object is a member of the shape that contains it SignatureLine signatureLine = shape.getSignatureLine(); Assert.assertEquals(signatureLine.getEmail(), "john.doe@management.com"); Assert.assertEquals(signatureLine.getSigner(), "John Doe"); Assert.assertEquals(signatureLine.getSignerTitle(), "Senior Manager"); Assert.assertEquals(signatureLine.getInstructions(), "Please sign here"); Assert.assertTrue(signatureLine.getShowDate()); Assert.assertTrue(signatureLine.getAllowComments()); Assert.assertTrue(signatureLine.getDefaultInstructions()); // We will be prompted to sign it when we open the document Assert.assertFalse(signatureLine.isSigned()); // The object may be valid, but the signature itself isn't until it is signed Assert.assertFalse(signatureLine.isValid()); doc.save(getArtifactsDir() + "Shape.SignatureLine.docx");
public java.util.UUID getId() / public void setId(java.util.UUID value)
This identifier can be associated with a digital signature, when signing document using
Example:
Demonstrates how to add new signature line to the document and sign it with personal signature using SignatureLineId.public static void sign() throws Exception { String signPersonName = "Ron Williams"; String srcDocumentPath = getMyDir() + "Document.docx"; String dstDocumentPath = getArtifactsDir() + "SignDocumentCustom.Sign.docx"; String certificatePath = getMyDir() + "morzal.pfx"; String certificatePassword = "aw"; // We need to create simple list with test signers for this example createSignPersonData(); System.out.println("Test data successfully added!"); // Get sign person object by name of the person who must sign a document // This an example, in real use case you would return an object from a database SignPersonTestClass signPersonInfo = gSignPersonList.stream().filter(x -> x.getName() == signPersonName).findFirst().get(); if (signPersonInfo != null) { signDocument(srcDocumentPath, dstDocumentPath, signPersonInfo, certificatePath, certificatePassword); System.out.println("Document successfully signed!"); } else { System.out.println("Sign person does not exist, please check your parameters."); } // Now do something with a signed document, for example, save it to your database // Use 'new Document(dstDocumentPath)' for loading a signed document } /// <summary> /// Signs the document obtained at the source location and saves it to the specified destination. /// </summary> private static void signDocument(final String srcDocumentPath, final String dstDocumentPath, final SignPersonTestClass signPersonInfo, final String certificatePath, final String certificatePassword) throws Exception { // Create new document instance based on a test file that we need to sign Document document = new Document(srcDocumentPath); DocumentBuilder builder = new DocumentBuilder(document); // Add info about responsible person who sign a document SignatureLineOptions signatureLineOptions = new SignatureLineOptions(); signatureLineOptions.setSigner(signPersonInfo.getName()); signatureLineOptions.setSignerTitle(signPersonInfo.getPosition()); // Add signature line for responsible person who sign a document SignatureLine signatureLine = builder.insertSignatureLine(signatureLineOptions).getSignatureLine(); signatureLine.setId(signPersonInfo.getPersonId()); // Save a document with line signatures into temporary file for future signing builder.getDocument().save(dstDocumentPath); // Create holder of certificate instance based on your personal certificate // This is the test certificate generated for this example CertificateHolder certificateHolder = CertificateHolder.create(certificatePath, certificatePassword); // Link our signature line with personal signature SignOptions signOptions = new SignOptions(); signOptions.setSignatureLineId(signPersonInfo.getPersonId()); signOptions.setSignatureLineImage(signPersonInfo.getImage()); // Sign a document which contains signature line with personal certificate DigitalSignatureUtil.sign(dstDocumentPath, dstDocumentPath, certificateHolder, signOptions); } /// <summary> /// Create test data that contains info about sing persons. /// </summary> private static void createSignPersonData() throws IOException { InputStream inputStream = new FileInputStream(getImageDir() + "Logo.jpg"); gSignPersonList = new ArrayList<>(); gSignPersonList.add(new SignPersonTestClass(UUID.randomUUID(), "Ron Williams", "Chief Executive Officer", DocumentHelper.getBytesFromStream(inputStream))); gSignPersonList.add(new SignPersonTestClass(UUID.randomUUID(), "Stephen Morse", "Head of Compliance", DocumentHelper.getBytesFromStream(inputStream))); } private static ArrayList<SignPersonTestClass> gSignPersonList;
public java.lang.String getInstructions() / public void setInstructions(java.lang.String value)
Example:
Shows how to create a line for a signature and insert it into a document.// Create a blank document and its DocumentBuilder Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // The SignatureLineOptions will contain all the data that the signature line will display SignatureLineOptions options = new SignatureLineOptions(); { options.setAllowComments(true); options.setDefaultInstructions(true); options.setEmail("john.doe@management.com"); options.setInstructions("Please sign here"); options.setShowDate(true); options.setSigner("John Doe"); options.setSignerTitle("Senior Manager"); } // Insert the signature line, applying our SignatureLineOptions // We can control where the signature line will appear on the page using a combination of left/top indents and margin-relative positions // Since we're placing the signature line at the bottom right of the page, we will need to use negative indents to move it into view Shape shape = builder.insertSignatureLine(options, RelativeHorizontalPosition.RIGHT_MARGIN, -170.0, RelativeVerticalPosition.BOTTOM_MARGIN, -60.0, WrapType.NONE); Assert.assertTrue(shape.isSignatureLine()); // The SignatureLine object is a member of the shape that contains it SignatureLine signatureLine = shape.getSignatureLine(); Assert.assertEquals(signatureLine.getEmail(), "john.doe@management.com"); Assert.assertEquals(signatureLine.getSigner(), "John Doe"); Assert.assertEquals(signatureLine.getSignerTitle(), "Senior Manager"); Assert.assertEquals(signatureLine.getInstructions(), "Please sign here"); Assert.assertTrue(signatureLine.getShowDate()); Assert.assertTrue(signatureLine.getAllowComments()); Assert.assertTrue(signatureLine.getDefaultInstructions()); // We will be prompted to sign it when we open the document Assert.assertFalse(signatureLine.isSigned()); // The object may be valid, but the signature itself isn't until it is signed Assert.assertFalse(signatureLine.isValid()); doc.save(getArtifactsDir() + "Shape.SignatureLine.docx");
public boolean isSigned()
Example:
Shows how to create a line for a signature and insert it into a document.// Create a blank document and its DocumentBuilder Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // The SignatureLineOptions will contain all the data that the signature line will display SignatureLineOptions options = new SignatureLineOptions(); { options.setAllowComments(true); options.setDefaultInstructions(true); options.setEmail("john.doe@management.com"); options.setInstructions("Please sign here"); options.setShowDate(true); options.setSigner("John Doe"); options.setSignerTitle("Senior Manager"); } // Insert the signature line, applying our SignatureLineOptions // We can control where the signature line will appear on the page using a combination of left/top indents and margin-relative positions // Since we're placing the signature line at the bottom right of the page, we will need to use negative indents to move it into view Shape shape = builder.insertSignatureLine(options, RelativeHorizontalPosition.RIGHT_MARGIN, -170.0, RelativeVerticalPosition.BOTTOM_MARGIN, -60.0, WrapType.NONE); Assert.assertTrue(shape.isSignatureLine()); // The SignatureLine object is a member of the shape that contains it SignatureLine signatureLine = shape.getSignatureLine(); Assert.assertEquals(signatureLine.getEmail(), "john.doe@management.com"); Assert.assertEquals(signatureLine.getSigner(), "John Doe"); Assert.assertEquals(signatureLine.getSignerTitle(), "Senior Manager"); Assert.assertEquals(signatureLine.getInstructions(), "Please sign here"); Assert.assertTrue(signatureLine.getShowDate()); Assert.assertTrue(signatureLine.getAllowComments()); Assert.assertTrue(signatureLine.getDefaultInstructions()); // We will be prompted to sign it when we open the document Assert.assertFalse(signatureLine.isSigned()); // The object may be valid, but the signature itself isn't until it is signed Assert.assertFalse(signatureLine.isValid()); doc.save(getArtifactsDir() + "Shape.SignatureLine.docx");
public boolean isValid()
Example:
Shows how to create a line for a signature and insert it into a document.// Create a blank document and its DocumentBuilder Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // The SignatureLineOptions will contain all the data that the signature line will display SignatureLineOptions options = new SignatureLineOptions(); { options.setAllowComments(true); options.setDefaultInstructions(true); options.setEmail("john.doe@management.com"); options.setInstructions("Please sign here"); options.setShowDate(true); options.setSigner("John Doe"); options.setSignerTitle("Senior Manager"); } // Insert the signature line, applying our SignatureLineOptions // We can control where the signature line will appear on the page using a combination of left/top indents and margin-relative positions // Since we're placing the signature line at the bottom right of the page, we will need to use negative indents to move it into view Shape shape = builder.insertSignatureLine(options, RelativeHorizontalPosition.RIGHT_MARGIN, -170.0, RelativeVerticalPosition.BOTTOM_MARGIN, -60.0, WrapType.NONE); Assert.assertTrue(shape.isSignatureLine()); // The SignatureLine object is a member of the shape that contains it SignatureLine signatureLine = shape.getSignatureLine(); Assert.assertEquals(signatureLine.getEmail(), "john.doe@management.com"); Assert.assertEquals(signatureLine.getSigner(), "John Doe"); Assert.assertEquals(signatureLine.getSignerTitle(), "Senior Manager"); Assert.assertEquals(signatureLine.getInstructions(), "Please sign here"); Assert.assertTrue(signatureLine.getShowDate()); Assert.assertTrue(signatureLine.getAllowComments()); Assert.assertTrue(signatureLine.getDefaultInstructions()); // We will be prompted to sign it when we open the document Assert.assertFalse(signatureLine.isSigned()); // The object may be valid, but the signature itself isn't until it is signed Assert.assertFalse(signatureLine.isValid()); doc.save(getArtifactsDir() + "Shape.SignatureLine.docx");
public java.util.UUID getProviderId() / public void setProviderId(java.util.UUID value)
The cryptographic service provider (CSP) is an independent software module that actually performs cryptography algorithms for authentication, encoding, and encryption. MS Office reserves the value of {00000000-0000-0000-0000-000000000000} for its default signature provider.
The GUID of the additionally installed provider should be obtained from the documentation shipped with the provider.
In addition, all the installed cryptographic providers are enumerated in windows registry. It can be found in the following path: HKLM\SOFTWARE\Microsoft\Cryptography\Defaults\Provider. There is a key name "CP Service UUID" which corresponds to a GUID of signature provider.
Example:
Shows how to sign a document with a personal certificate and a signature line.Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); SignatureLineOptions signatureLineOptions = new SignatureLineOptions(); signatureLineOptions.setSigner("vderyushev"); signatureLineOptions.setSignerTitle("QA"); signatureLineOptions.setEmail("vderyushev@aspose.com"); signatureLineOptions.setShowDate(true); signatureLineOptions.setDefaultInstructions(false); signatureLineOptions.setInstructions("Please sign here."); signatureLineOptions.setAllowComments(true); SignatureLine signatureLine = builder.insertSignatureLine(signatureLineOptions).getSignatureLine(); signatureLine.setProviderId(UUID.fromString("CF5A7BB4-8F3C-4756-9DF6-BEF7F13259A2")); doc.save(getArtifactsDir() + "DocumentBuilder.SignatureLineProviderId.docx"); Date currentDate = new Date(); SignOptions signOptions = new SignOptions(); signOptions.setSignatureLineId(signatureLine.getId()); signOptions.setProviderId(signatureLine.getProviderId()); signOptions.setComments("Document was signed by vderyushev"); signOptions.setSignTime(currentDate); CertificateHolder certHolder = CertificateHolder.create(getMyDir() + "morzal.pfx", "aw"); DigitalSignatureUtil.sign(getArtifactsDir() + "DocumentBuilder.SignatureLineProviderId.docx", getArtifactsDir() + "DocumentBuilder.SignatureLineProviderId.Signed.docx", certHolder, signOptions);
public boolean getShowDate() / public void setShowDate(boolean value)
Example:
Shows how to create a line for a signature and insert it into a document.// Create a blank document and its DocumentBuilder Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // The SignatureLineOptions will contain all the data that the signature line will display SignatureLineOptions options = new SignatureLineOptions(); { options.setAllowComments(true); options.setDefaultInstructions(true); options.setEmail("john.doe@management.com"); options.setInstructions("Please sign here"); options.setShowDate(true); options.setSigner("John Doe"); options.setSignerTitle("Senior Manager"); } // Insert the signature line, applying our SignatureLineOptions // We can control where the signature line will appear on the page using a combination of left/top indents and margin-relative positions // Since we're placing the signature line at the bottom right of the page, we will need to use negative indents to move it into view Shape shape = builder.insertSignatureLine(options, RelativeHorizontalPosition.RIGHT_MARGIN, -170.0, RelativeVerticalPosition.BOTTOM_MARGIN, -60.0, WrapType.NONE); Assert.assertTrue(shape.isSignatureLine()); // The SignatureLine object is a member of the shape that contains it SignatureLine signatureLine = shape.getSignatureLine(); Assert.assertEquals(signatureLine.getEmail(), "john.doe@management.com"); Assert.assertEquals(signatureLine.getSigner(), "John Doe"); Assert.assertEquals(signatureLine.getSignerTitle(), "Senior Manager"); Assert.assertEquals(signatureLine.getInstructions(), "Please sign here"); Assert.assertTrue(signatureLine.getShowDate()); Assert.assertTrue(signatureLine.getAllowComments()); Assert.assertTrue(signatureLine.getDefaultInstructions()); // We will be prompted to sign it when we open the document Assert.assertFalse(signatureLine.isSigned()); // The object may be valid, but the signature itself isn't until it is signed Assert.assertFalse(signatureLine.isValid()); doc.save(getArtifactsDir() + "Shape.SignatureLine.docx");
public java.lang.String getSigner() / public void setSigner(java.lang.String value)
Example:
Shows how to create a line for a signature and insert it into a document.// Create a blank document and its DocumentBuilder Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // The SignatureLineOptions will contain all the data that the signature line will display SignatureLineOptions options = new SignatureLineOptions(); { options.setAllowComments(true); options.setDefaultInstructions(true); options.setEmail("john.doe@management.com"); options.setInstructions("Please sign here"); options.setShowDate(true); options.setSigner("John Doe"); options.setSignerTitle("Senior Manager"); } // Insert the signature line, applying our SignatureLineOptions // We can control where the signature line will appear on the page using a combination of left/top indents and margin-relative positions // Since we're placing the signature line at the bottom right of the page, we will need to use negative indents to move it into view Shape shape = builder.insertSignatureLine(options, RelativeHorizontalPosition.RIGHT_MARGIN, -170.0, RelativeVerticalPosition.BOTTOM_MARGIN, -60.0, WrapType.NONE); Assert.assertTrue(shape.isSignatureLine()); // The SignatureLine object is a member of the shape that contains it SignatureLine signatureLine = shape.getSignatureLine(); Assert.assertEquals(signatureLine.getEmail(), "john.doe@management.com"); Assert.assertEquals(signatureLine.getSigner(), "John Doe"); Assert.assertEquals(signatureLine.getSignerTitle(), "Senior Manager"); Assert.assertEquals(signatureLine.getInstructions(), "Please sign here"); Assert.assertTrue(signatureLine.getShowDate()); Assert.assertTrue(signatureLine.getAllowComments()); Assert.assertTrue(signatureLine.getDefaultInstructions()); // We will be prompted to sign it when we open the document Assert.assertFalse(signatureLine.isSigned()); // The object may be valid, but the signature itself isn't until it is signed Assert.assertFalse(signatureLine.isValid()); doc.save(getArtifactsDir() + "Shape.SignatureLine.docx");
public java.lang.String getSignerTitle() / public void setSignerTitle(java.lang.String value)
Example:
Shows how to create a line for a signature and insert it into a document.// Create a blank document and its DocumentBuilder Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // The SignatureLineOptions will contain all the data that the signature line will display SignatureLineOptions options = new SignatureLineOptions(); { options.setAllowComments(true); options.setDefaultInstructions(true); options.setEmail("john.doe@management.com"); options.setInstructions("Please sign here"); options.setShowDate(true); options.setSigner("John Doe"); options.setSignerTitle("Senior Manager"); } // Insert the signature line, applying our SignatureLineOptions // We can control where the signature line will appear on the page using a combination of left/top indents and margin-relative positions // Since we're placing the signature line at the bottom right of the page, we will need to use negative indents to move it into view Shape shape = builder.insertSignatureLine(options, RelativeHorizontalPosition.RIGHT_MARGIN, -170.0, RelativeVerticalPosition.BOTTOM_MARGIN, -60.0, WrapType.NONE); Assert.assertTrue(shape.isSignatureLine()); // The SignatureLine object is a member of the shape that contains it SignatureLine signatureLine = shape.getSignatureLine(); Assert.assertEquals(signatureLine.getEmail(), "john.doe@management.com"); Assert.assertEquals(signatureLine.getSigner(), "John Doe"); Assert.assertEquals(signatureLine.getSignerTitle(), "Senior Manager"); Assert.assertEquals(signatureLine.getInstructions(), "Please sign here"); Assert.assertTrue(signatureLine.getShowDate()); Assert.assertTrue(signatureLine.getAllowComments()); Assert.assertTrue(signatureLine.getDefaultInstructions()); // We will be prompted to sign it when we open the document Assert.assertFalse(signatureLine.isSigned()); // The object may be valid, but the signature itself isn't until it is signed Assert.assertFalse(signatureLine.isValid()); doc.save(getArtifactsDir() + "Shape.SignatureLine.docx");