Skip to main content

addObjectText

Displays a text string on the pad, using the current properties.

wizCtl.addObjectText(id, x, y, text)
ParameterDescription
id

String that identifies the text. Can be null or an empty string.
The following values have special meanings when used with a signature object:

  • who - The text is also used as the name of the signatory.
  • why - The text is also used as the reason for signing.
  • when - Reserved for future use.
x, y

Position of the top-left corner of the object on the pad display.
The value is either an absolute position in pixels or one of the following strings:

  • x: "left", "right", "centre"
  • y: "top", "middle", "bottom"
textText to display. Use \n for a line break.
Return values
The added text object. Throws an exception if an error occurs.

The returned object has a rect property with the displayed area: upperLeftXpixel, upperLeftYpixel, lowerRightXpixel and lowerRightYpixel. Use it to position other objects relative to the text.

The following example adds a title and a line underneath it:

wizCtl.setProperty({font: {name: "verdana", size: 20, color: "black"}});
const titleText = wizCtl.addObjectText("", "left", "top", "Wizard Demo");
wizCtl.addPrimitive(sigSDK.PrimitiveType.Line, "left", titleText.rect.lowerRightYpixel, "right", titleText.rect.lowerRightYpixel, 2);