Xiaoxin Li
08/23/2024, 2:19 PMCeligo AI
08/23/2024, 2:20 PMAI generated answer (using internal Slack threads):Based on the conversations, it seems like you are trying to add line breaks to an address field in a PDF template. The issue you are facing is that the line breaks are not being rendered correctly and instead, they are being displayed as
<br/>
in the output.
One solution to this problem is to replace the newline characters (\r\n
) with a unique character in your data source, and then replace that unique character with <br/>
in your PDF template. Here's how you can do it:
1. In your data source, replace the newline characters with a unique character. For example, you can use the pipe character (|
):
javascript
var jsonPDFData = {
"mainaddress_text": "NEW PORT PACIFIC LIMITED\r\nUnit B 17/F United Centre\r\n95 Queensway Admiralty \r\nHong Kong"
};
jsonPDFData.mainaddress_text = jsonPDFData.mainaddress_text.replace(/\r\n/g, '|');
2. In your PDF template, replace the unique character with `<br/>`:
html
${jsonData.mainaddress_text?replace("|", "<br/>")}
This way, the line breaks should be rendered correctly in your PDF.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
08/23/2024, 2:20 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.844820082
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.842774391
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.837997615
Celigo AI
08/23/2024, 2:20 PM