How to send image data or retrieve images from a file or URL?

The template determines the size and location of where an image appears in a finished document.

However, the "content" of the image that appears in the document is determined by the data.

When calling the REST API of Cloud or Torando, there are three different ways to provide image data.  You can...

1) Send the image as a BASE64 encoded binary representation of the image as part of your data

In JSON format, your data would look like this:

"logoImage":"image:base64:iVBORw0KGgoAAAA... "

2) Use a file name, also called stock images

This approach is useful where the same image (eg: a signature or an icon) will be used multiple times, possibly in many different documents.

In JSON format, your data would look like this:

"logoImage":"[userImage:customers/defaultLogo.png]"

Note the values are surrounded by square "[ ]" brackets.  The text "userImage:" precedes the filename.  The filename can also include a path to the image.

CLOUD: If you have created folders to organise your images, the path should include those folders.

TORNADO: The images should be stored in the same folder used for the templates.  You may like to create a top level folder (for example: "Images") to separate them from your templates. In that case your would use:
"[userImage:Images/imageName.jpg]"

3) the URL of the image

This approach may be useful where the image is dynamically generated and changes for each document.

"customerSalesPieChart":"[imageUrl:https://example.com/recentSalesByCust11021.png]"

Note the values are surrounded by square "[ ]" brackets.  The text "imageUrl:" precedes the URL path.

The URL needs to be whitelisted, before it can be used.

CLOUD: To whitelist a URL please contact support to organize this.

TORNADO: To whitelist a URL you need to apply a Custom Setting on the Configuration page of the Tornado Console.  The setting is: "docmosis.external.resources.whitelist=https://example.com;http://another.com" (without the quotes).  To whitelist multiple domains, seperate each URL with a semi-colon.  Enter the URL in the Custom Setting textbox, then hit the Save button and then hit Restart (on the Status page).

 

Please refer to the Web Services Guide for further details on how to format/structure your image data.

Feedback

Invalid Input

Sorry, this field will only accept letters and numbers, and not special characters, to limit spam.

Sorry, this field will only accept letters and numbers, and not special characters, to limit spam.

Invalid Input

Applies To

Docmosis-Java Tornado Cloud
Version(s) - ALL ALL

Related items