PDF DataMapper Input and Dynamic Background

Hi All,

My Print Section already set the Background as ‘From PDF DataMapper input’, but I still need to include letterhead file dynamically according to data.
Kindly advise how should I do this.

Thanks and Regards,

Hi Janice,

You could achieve this by dynamically setting the stationery image for your media entry using a Control script. First create a Control script via the toolbar of the Scripts panel. Open the script and remove the sample code. The sample below sets the stationery image for the front of Media 1 based on a field called ‘someField’.

let someField = record.fields.someField
let mediaEntry = merge.template.media["Media 1"]

switch(someField) {
  case 'A':
    mediaEntry.stationery.front.url = 'images/stationery-A.pdf'
  case 'B':
    mediaEntry.stationery.front.url = 'images/stationery-B.pdf'
    mediaEntry.stationery.front.url = 'images/stationery-Other.pdf'

Hope this helps,


Hi Erik,

It is not working for my case. Below is my print section’s property.

The sample code sets the stationery image to the Media (not the section). This allows you to have both a section background and a stationery image. Happy to have a look at your template. Not sure if that can be shared here, will send you a direct messages with my details.