How add an image in a messageBottom?

How add an image in a messageBottom?

wawinwawin Posts: 2Questions: 1Answers: 0

I´m trying to add an image like an e-signature under the table but it doesn´t work.

this is my code:

buttons: [
            {
                extend: 'pdf',
                pageSize: 'LEGAL',
                title: 'Comprobante de pedido',
                text: 'Exportar en PDF',
                filename: `Jireh PC Pedido No. `+numPed+``,
                messageBottom: {
                  lineHeight: 5,
                  text: '\n Autorizado por: \n',
                  customize: function ( doc ) {
                    doc.content.splice( {
                      margin: [ 0, 0, 0, 12 ],
                      alignment: 'center',
                      image: `data:image/png;base64,.............`
                    });
                  },
                  alignment: 'center',
                  margin: [ 0, 0, 0, 12 ],
                },
                customize: function ( doc ) {
                // Splice the image in after the header, but before the table
                doc.content.splice( 1, 0, {
                    margin: [ 0, 0, 0, 12 ],
                    alignment: 'center',
                    image: `data:image/png;base64,.........`
                } );
                // Data URL generated by http://dataurl.net/#dataurlmaker
            }
            },
        ]
  });

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,309Questions: 26Answers: 4,947
    Answer ✓

    If you look at doc.content you will see its an array. If you want the image at the end you can use Javascript Array Push Method. Checkout this example:
    http://live.datatables.net/helidefe/1/edit

    It uses console.log so you can see the array. Then it pushes the image onto the array which ends up at the end of the document.

    Is this what you want?

    Kevin

  • wawinwawin Posts: 2Questions: 1Answers: 0

    yeah!!. you have helped me much ;)

This discussion has been closed.