We are now embedding images into document when generating it from TeamDesk.
While ago, we’ve added settings for specifying thumbnail size for attachment columns. Now documents respect these settings and downscale images accordingly. Images from URL columns and formulas are embedded in a full scale by default. To override this behavior you can add #ps suffix after the field name in MERGEFIELD code to specify image’s bounding box size. The image will retain its aspect ratio and won’t exceed box dimensions – no upscaling is performed.
The suffix accepts either one number to specify square bounding box or two numbers separated by “x” to specify rectangular bounding box and the unit of measurement – either in, cm, mm, pt or px.
Suppose there is a column called Image in your application. By default, { MERGEFIELD Image } is generated into the document template. To fit its content into 200x200px box modify field code to { MERGEFIELD Image#ps200px }. To fit it into 6.5x10cm box, use { MERGEFIELD Image#ps6.5x10cm }.
To illustrate it, let’s create simple document with Logo column pointing to TeamDesk logo which is 450×450 image (approximately 12x12cm)
And here are results:
As you can see, first logo was downscaled into 100x100px box. Second logo, despite rectangular box 5x10cm was specified, was downscaled to 5x5cm to maintain its aspect ratio. Since last box’s dimensions exceed logo size, third logo was not upscaled, rather retaining it’s original 12x12cm size.
Enjoy.