This can be achieved with document generation available on the version 2.1 of the eSignature REST API. Keep in mind it is available in all developer accounts, but must be purchased for production account plans.