With FormAssembly (https://www.formassembly.com/) you can create web forms and connect the forms with other thrid-party services.
This article explains how to generate a PDF document from FormAssembly, using Docmosis (https://docmosis.com).
In this example we create a simple webform, using FormAssembly, to collect data and initiate the document generation.
When the form is submitted, a HTTPS Connector sends the data to Docmosis Cloud service. The Cloud service merges the data with a Microsoft Word template to generate a PDF letter. The generated letter is then delivered via email.
You will need
Docmosis Cloud account
If you don't already have a Docmosis Cloud account, you can sign up for a free trial here.
Once you have an account you should log in to the Docmosis Cloud Console.
Note: This example uses the US region for storing templates and generating the document. You can choose your preferred region when following this example.
If you don't have a FormAssembly account, start a triled here.
Prepare Docmosis for generating the document
To prepare Docmosis you will need to upload the example template and retrieve the API access details for your account.
Upload the template to Docmosis
Docmosis templates are regular Microsoft Word documents, with special placeholders that will be replaced with the data. Below you can download an example template and then upload the template to your Docmosis Cloud account.
- First download the provided template.
- Log in to Docmosis Cloud, using your email and password.
The default region for the account is selected. In this example, the region below is US (Oregon).
- Create a new folder for storing the downloaded template. Still in the Templates tab, click New Folder.
- Create a new folder named FormAssembly.
- Click on the new FormAssembly folder to open it.
Click Upload Template, then select the template to upload it.
The template is uploaded to the selected FormAssembly folder.
Get the Docmosis Cloud access key and URL
Copy your Cloud access key and the URL for your selected region and paste these into a text editor, such as Notepad.
- Select Account from the left menu bar.
- Copy the URL for your selected region, US (Oregon) in this example, and paste it into Notepad.
- Click Show Access Key. Now copy the access key and paste it into Notepad.
To collect and send data to Docmosis from FormAssembly, create a form for the input data, then add a connector to send this and other data to Docmosis.
Build a new form in FormAssembly
- Log in to your FormAssembly account, using your username or email, and password.
In this example, the “Apply for a Position” FormAssembly template is used to create the form.
- In FormAssembly, select TemplateLibrary from the side menu, then filter on the Human Resources (HR) category.
- Click Use on the Apply for a Position template.
The new form opens in Build mode.
- Add content to the form, if additional input fields are required, and format the fields if necessary.
- Click Save to save the form.
In this example, there is a new title, and the "Name", "E-mail", and "Position applying for" fields are set as required.
Add a connector to the form in FormAssembly
- Click on Connectors in the side menu, then click on Add connector for after form submission.
- Choose HTTPS to securely send data to Docmosis.
Configure the connector in FormAssembly
- Click Configure, to configure and enable the connector.
- Update the connector description: click on the description to edit it.
- Update the status to Enabled.
- Add the Remote Script details: paste in the Docmosis URL for your processing location, and append with "renderForm". Keep the POST (default) HTTP request method.
- Edit the field names so that they match the names in the Docmosis template. Note: these are case sensitive.
Note: Only some of the fields are used in the Docmosis template, and can be removed from the connector.
- Add custom fields that are not provided in the form template, for the Docmosis Render request parameters:
|In this example:|
|accessKey||Paste in the access key for your Docmosis account||Copied to Notepad in earlier step|
|templateName||The folder name and template name in Docmosis||/FormAssembly/LetterTemplate.docx|
|outputName||The name for the rendered document||Use the formula f option to build up a file name that includes the applicant name|
|outputFormat||The format of the rendered document|
|mailSubject:||Specify a subject line, if the mailto: option was used.||Use the formula f option to build up a subject line that includes the applicant name|
Note: the mailto: email address is the same one used for the Login on your Docmosis trial account.
- Add fields for values that will be used in the LetterTemplate.
|acknowledgedate||Use the formula f option to get the current local date.|
|hrRep.Name||The name of your HR representative|
|hrRep.Title||The title of your HR representative|
- Save the connector.
Generate a document using the form
The new form is ready to try out.
- Click View in the side menu to view the form.
- Fill in the form details, then click Submit.
The connector posts the form and other details to Docmosis, and Docmosis generates a PDF using the supplied data, then sends the document as an attachment to the supplied email address.
- Open the email and the generated PDF in the attachment.
The generated PDF contains the fields sent by the FormAssembly connector.
Note: If you do not get the expected results, read the message in the Connector log in FormAssembly to troubleshoot the issue.