How to add different images in a generated PDF document?

written by Răzvan Puiu

Do you need to generate documents that contain different images based on some content you store in your database?

Do you have an URL of each image?

Cool, this means you'll love this feature:

Static/Dynamic Images

How it works?

When hovering on the image element, two buttons appear: Static and Dynamic:

Static will prompt you to upload an image from your local machine. These images will be stored in our database and be directly placed in your PDF document. This feature is useful, for example when you design an invoice that contains your company's logo.

Static images don't need to have an Element Id associated.

Dynamic will directly upload a placeholder image to the template. After setting an Element Id, you can send an image URL as the payload of the API call as follows:

  "content": {
  "myDynamicImg": ""

The image will be formatted the way you formatted the placeholder in the designer. Feel free to use the Preview button to test your template with an actual URL.

Dynamic images are not saved anywhere. The only thing you need to remember here is that your URL needs to end with the image extension.

With the dynamic images it's easy to generate PDF documents that represent concert tickets, resumes and much more.