Add image inside body with autoTable library

42 views Asked by At

I try to add image inside body show [object object]
Please anyone can help

pdf.autoTable({
  startY: rowY,
  body: [
    [
      { content: "", styles: { cellWidth: 5 } },
      {
        image: user.image,
        width: 30,
        colSpan: 2,
      },
    ],
  ],
});
1

There are 1 answers

0
Oyinlade Demola On

Looks like your user variable is an array which means you are accessing it wrong.

pdf.autoTable({
  startY: rowY,
  body: [
    [
      { content: "", styles: { cellWidth: 5 } },
      {
        image: user[0].image,
        width: 30,
        colSpan: 2,
      },
    ],
  ],
});