SKIP AHEAD TO
When would you add uploaded images to a DOC GEN document?
How to add images into your document
How to restrict image sizes
Limitations
When would you add uploaded images to a DOC GEN document?
When images have been uploaded by the end user during an Assessment through the File Upload field in a FORM page, you can display this inside DOC GEN documents.
How to add images into your document
Follow the below syntax to add uploaded images to your DOC GEN document.
- To start the image syntax, use the variable with the hash i.e. {{#FILE reference}}
- To insert the image(s), use the fixed variable i.e. {{%image}}
- To end the image syntax, use the file variable with a forward slash i.e. {{/FILE reference}}
Note: Each line of text must be separated with paragraph spaces as specified below.
WARNING: Please do not copy and paste any formatting templates in this article as transferring text from this article to your Word document may cause errors when generating your document in Checkbox. We strongly encourage you to write the syntax manually to avoid these issues in your document.
INCORRECT Formatting: | CORRECT Formatting: |
{{#FILE1}} {{%image}} {{/FILE1}} |
{{#FILE1}}
{{%image}}
{{/FILE1}} |
Where 'FILE1' is the variable name of the File Upload field and '%image' is the fixed variable where all uploaded images will be appear in the document. This syntax will allow the user to add the image into the Document at the size that it was uploaded. Should the size of the image exceed the width of the document the image will be automatically resized to fit the width of the page.
Example in document:
How to restrict image sizes
WARNING: Please do not copy and paste any formatting templates in this article as transferring text from this article to your Word document may cause errors when generating your document in Checkbox. We strongly encourage you to write the syntax manually to avoid these issues in your document.
To restrict the size of the image you can use either of the following two methods.
- Restricting the pixel width of the image.
Add the " | size:#" syntax after "%image" where # is the pixel size of the width restriction you want to set for the uploaded image.
For example:
Formatting: |
{{#FILE1}}
{{%image | size:100}}
{{/FILE1}} |
By adding the " | size:100" syntax, this restricts the image to a width of 100 pixels. The image will retain the original ratio by adjusting the pixel height automatically.
Example in document:
- Restricting both the pixel width and pixel height of the image.
Add the " | size:#:#" syntax after "%image" where the first # is the pixel size of the width restriction and the second # is the pixel size of the height restriction you want to set for the uploaded image.
For example:
Formatting: |
{{#FILE1}}
{{%image | size:200:300}}
{{/FILE1}} |
By adding the " | size:200:300" in the middle syntax, this restricts the image to a width of 200 pixels and pixel height of 300.
Note: By default the image will have a centre alignment.
Example in document:
Limitations
- Supported image file types that can be uploaded are JPEG and PNG
- Only up to 50 images can be uploaded in the File Upload field at one time (For example: To upload 100 images, you will need to upload the first 50 images before continuing to upload the remaining 50 images)
Related Articles
- Reference Variables in DOC GEN Documents
- Conditions in DOC GEN Documents
- Insert Looping Text and Dynamic Tables
- Add a DOC GEN document to your App