Skip to main content
manjit.1486
November 2, 2023
Question

HTML to PDF conversion- issue getting multiple entries

  • November 2, 2023
  • 4 replies
  • 0 views

Hello everyone,

I am using plugin HTML to PDF.

I have used two nodes in process model "HTML DOC from template" and "HTML to PDF". In first node("HTML DOC from template") I am passing process variable for  ###name###  (pv!customer.name) and so on for others.

Successfully converted HTML to PDF file but I am having issue with multiple entries. Like: I have total 10 records but in pdf all records shown up in one line with comma separator.

Note: Created a rule for this where I get all records but getting issues passing this rule in process model node ("HTML DOC from template").


for example:

<table>
<tr>
<td> <h3> Name </h3> </td>
<td> <h3> Address</h3> </td>
<td> <h3> Unit </h3> </td>

</tr>
<tr>
<td> ###name### </td>
<td> ###address### </td>
<td> ###unit### </td>
</tr>
</table>

Please assist me on this.

4 replies

stefanhelzle0001
November 2, 2023

There was a very similar discussion just recently.

If you pass a list of values into a single placeholder, it turns this into a comma separated list. If you need to output a list of tables, you need to create the necessary HTML in a loop.

manjit.1486
November 2, 2023

Thanks. Could you please  guide how to achieve this? How to link a loop with specific data?

sriramk5349
November 3, 2023

Hi manjit.1486,

I have added a sample code here. Please go through it and construct your expression in such a way.

a!localVariables(
local!data:{
a!map(
name:"xyz",
age:12
),
a!map(
name:"abc",
age:13
)
},
"
<table>
<tr>
<td> <h3> Name </h3> </td>
<td> <h3> Age</h3> </td>
</tr>"
&joinarray(a!forEach(
items: local!data,
expression: "
<tr>
<td> "&fv!item.name &" </td>
<td> "&fv!item.age &" </td>
</tr>

"
)," ")
&"
</table>
"
)