You are here: Document Engine > Use Case - Dynamically Adding Signatures in the Document Engine

Use Case - Dynamically Adding Signatures in the Document Engine


You will use the File Manager, Commerce attributes, and the Document Engine to dynamically add signatures to documents. Before beginning this tutorial, you should understand how to use the File Manager, BML (BigMachines Extensible Language), and the Document Engine.


Before using this tutorial, you must:

ClosedSee Sample Document


ClosedStep 1: Uploading Signatures to the File Manager

  1. Create a folder in the File Manager to store your signature images. In this case, the folder will be called “Signatures".
  2. Create a signature image (.jpg) for each user that will have a signature included on some document.
  3. Name the file after the user’s name, without spaces.
  4. User's Name: Alan Jefferson

    Filename: AlanJefferson.jpg

    User's Name: Matt Washington

    Filename: MattWashington.jpg

  5. Upload the image files into the ‘Signatures’ folder in the File Manager.

ClosedStep 2: Creating Commerce Attributes

  1. Navigate to the Documents List of the Commerce Process you will use.
  2. Create the following main-document commerce attributes:
  3. Create a commerce library, Dynamic Signatures, for the Commerce Process you will use.
  4. Select input attributes:
  5. Enter the following BML script.  ClosedClick here to see sample script.

    returnString = “”;

    signatureExists = false;


    //Set the URL for the signature file

    file = replace(preparedByName_quote, “ “, “”) + “.jpg”;

    signatureURL = “http://”

    + _system_supplier_company_name

    + “”

    + _system_supplier_company_name

    + “/image/signatures/”

    + file;


    //Script determine whether the signature exists or not

    error = “NO FILE”;

    response = urldatabypost(url, “”, error);

    signatureExists = response <> error;


    //Return string

    returnString = “1~signatureExists_quote~” + string(signatureExists) + “|” + “1~signatureURL_quote~” + signatureURL + “|”;

ClosedStep 3: Updating Print Actions

  1. Run the Library Function on the Print Actions. Add the following to the Advanced Modification function of these actions:
  2. This script should be added right before the semicolon in the return statement:

    + commerce.dynamicSignatures();

ClosedStep 4: Modifying the Document Engine Document

  1. Modify the Global XSL Snippet of the Document by adding the following line to the top of the Global XSL Snippet in the Document Engine if it does not already exist:

    <xsl:variable name=”main_doc” select=”/transaction/data_xml/document[@document_var_name=’quote_process’]/”/>

  1. Add the Signature Image to the Document
  2. Choose the location of the signature in the Document Engine
  3. In this location, create a Conditional Section with the condition: Signature Exists = true
  4. Insert an XSL snippet as the conditional content with the following XSL code:

    <xsl:variable name=”signatureImage” select=”$main_doc/signatureURL_quote”/>

    <fo:external-graphic src=”{$signatureImage}” content-height=”.2in” height=”.2in”/>



Related Topics Link IconSee Also