*Note: This article is for embedding images that are sent over in the Merge Data. Not embedding signatures from e-signature services like DocuSign, AdobeSign, HelloSign, etc.
*Also Note: All images merged over must be publically accessible so we can download it to our system.
Due to the way Microsoft Office files are designed, embedding dynamic images in an Office document is not as simple as when you are using Formstacks Document Builder. Although this article is focused on embedding images on different types of office document formats, you can utilize some of the steps detailed below with Formstacks built in document builder. For more information on using our builder to embed images, check out this article. Additionally, we have this article if you plan on using a fillable pdf.
There are two different methods you can choose from below based on the type of document you're creating. For the first method, it can only be used with word & powerpoint and is the easier method of the two. For more information, scroll below or click here for our dynamic image method .
For the second method, it's compatible with each document type, but requires a few more steps and is more limited. For more information, scroll below or click here for our placeholder method .
Insert a dynamic image (Word, PPT only)
If you are looping through a list of images, using the other placeholder method will produce the same image over and over again. To fix this, we've created a way to add an image to your document using the following method and tag:
{$image|insert_image:width:height:max_width(optional):max_height(optional)}
Here's a real example:
{$image|insert_image:300:100}
To break down this tag, $image is the merge field, 300 is the width, and 100 is the height (you can change these to create the correct size image).
You would place this tag in the spot that you want your image inserted and it will be replaced with your image when the document is merged.
If you wanted to automatically size the height to keep proportions, you can use a "0" for the height like this:
{$image|insert_image:300:0}
If you'd like to set a maximum height to your image, you would use a tag like this:
{$image|insert_image:300:0:0:200}
What type of image formats are supported?
To ensure that your image file formats are supported, choose file types .png or .jpeg.
Using the placeholder method
For this example, we will be embedding a Formstack signature in our DOCX. First thing you will need to do is embed an image in your document as placeholder for where you want the final image to go. The size that you make this image placeholder will be the size that the final image will be. It is important to note that you must use a placeholder with the same file format (JPEG or PNG) as the final image.
If you do not have an image placeholder to use, we have built an image generator that you can use. Here is an example URL:
http://www.webmerge.me/images/image.php?width=300&height=100&type=png
If you go to that URL, it will load an image. Simply right-click the image and copy the image, then paste that image into your word document. In the URL, you will notice there is width and height setting so you can control the size of the image.
Also, the type parameter (possible values: png or jpeg) controls the type of the image. Go ahead and change those parameters to create a customized image.
The next step is the setup the variable placeholder for your image. You can put this placeholder anywhere in your document – it is simply used to map the image URL to the image element in your document. For the most part, it’s the same format as other variables, but we will add a little more info. Below is an example variable placeholder for the image:
{$MyImage|image:1:png}
In the above example, the variable name is “MyImage”, then the “|” indicates options after. Each image in a DOCX is stored using a numerical identifier, so the “1” in the image indicates that identifier.
Once you have that in place, you’re all set!
**If you are inserting more than 1 image in your document, you'll want to make sure you use different images as the placeholders because Word will treat them as the same image. If you are using our image generator, simply add a pixel to the width or height of the image and that will do the trick!