Document Mapper & Emailing PDF

Document Mapper in Saltbox allows you to take input data from any source and merge it into a PDF or HTML body document. This means you can email, FTP, or attach a document to almost any target.

 

This is a simple, lightweight word processing tool that lets you design a PDF or HTML document and then use merging data from the Actions input message.

 

Start by understanding the principle of structuring your workflows to use a document. Before you can send a document in an email (for example), you first have to generate the document.

 

 

This is done using the "Transform a Message" action.

  • Choose the configuration "Apply a Map". 
  • Choose "DocumentMap". 
  • Name the map.
  • Choose the output PDF or HTML.
  • Save its output to a workflow message.

 

 

Once you've set this configuration, the workflow action will have an additional icon available to enter the document mapper page.

 

 

This launches the document mapper window, where you can style and generate your document layout, including inserting images and media (links or things hosted in the Saltbox Project Files).

 

 

 

The "Toolbox" icon near the top left of the screen lets you choose a sample of your input message.

 

The toolbox (once expanded, as seen below) lets you drag and drop fields from the toolbox into your document.

 

 

If you have an array collection in your data, you can drag the array into the document, which creates a for each loop. You can drag any field you want to display repeatedly into this loop.

 

 

 

On the right side, you can choose PDF view (if your desired output is PDF) or HTML view.

 

 

Now that you've designed your document, it's time to do something with it.

 

The "Out Message" of your workflow action is the document in Base64 encoded text. 

 

You can use this to send the file to the desired system.

 

Most systems that accept attachments through an API expect Base64 as the content type and will readily accept it.

 

 

 

To send the generated document as an email attachment, use the action from the outgoing email connector "Send a Message". Tick the "Include Attachments" tickbox and select the workflow message that was generated in the document mapper action.

 

 

-