If you are using a custom data source you could es...
# advancedpdf
m
If you are using a custom data source you could escape all fields in JS first, but if you are just merging a record I believe you will have to escape within the template.
a
@michoel Thanks for the response So I am getting all the data from a created search in I am passing the data as a render Data
Copy code
var renderer = render.create()
renderer.addCustomDataSource({
          format: render.DataSource.OBJECT,
          alias: "searchData",
          data
})

var xmlTemplateFile = file.load('./custtmpl_cps.template.ftl')
var xmlStr = xmlTemplateFile.getContents()
renderer.templateContent = xmlStr

 var newfile = renderer.renderAsPdf()
  
 var newfile = renderer.renderAsPdf()
How would I escape the data from my Object? Or rather what format would I need to escape it to
This worked. Is this what you meant? I used ramda to map the object
Copy code
const escapedData = R.map(val => {
            if (R.type(val) == 'String')
                return val.replace('&', '&')
            return val
        })(data)
m
Yes, exactly. I wouldn't use ramda just for that but if you are using it anyway..
a
👍 Yes I am using it anyways. Not an extra import