Using dynamic images in a document generation process to make the dynamic even more dynamic.

One of the most fascinating aspects of  Adobe Document Generation is how incredibly flexible it is. One aspect of the API that can really enhance the final result is the ability to include images in your template. In a typical use case, you would provide a static image defined in your data used with the API. In this blog post I’m going to demonstrate a more advanced example — dynamically generating images, in our case, charts, on the fly.

The Basics

Before we get into a more advanced demo, let’s quickly cover the basics. (My coworker has a  very deep look into Document Generation and images you should check out as well.) As our  docs describe, using a dynamic image in your Word template requires a few steps.

First, you add an image to your document. It doesn’t matter what image you pick, it’s just a placeholder, but you’ll want to place it in your document as you like and ensure you’ve sized it as expected. Once done, you right-click on the image and select the “Edit Alt Text” option. In that alt text, you supply JSON:

JSON

{
  "location-path": "logo",
  "image-props": {
    "alt-text": "This is an alt-text for the image placeholder"
  }
}

#javascript #tutorial #web dev #api #pdf

Document Generation With Dynamic Image Generation
1.65 GEEK