*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.
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 our Builder. But, it is still possible with a little bit of work. Below is a quick tutorial on how you can embed a dynamic image (signature, uploaded picture, etc) into your Word DOCX documents. 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:
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:
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. To determine what number your image is, add &images=1 to the end of the URL when you are on the Manage File tab - this page will show you all of the images in your document. The “png” in the placeholder represents the image type (possible values: png or jpeg).
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!
Inserting a dynamic image (Word and PPT only)
If you are looping through a list of images, using the placeholder method above will produce the same image over and over again. To fix this, we've created a new way to add an image to your document using the following tag:
Here's a real example:
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:
If you'd like to set a maximum height to your image, you would use a tag like this: