0
votes

I followed this link https://datatables.net/extensions/buttons/examples/html5/pdfImage.html and able to get datatable working with pdfmake. However if a column (or a cell) contains image, that cell is not getting exported into pdf. How can i tweek this library to include image in the exported file. it appears buttons.html5.min.js has the logic to export the data. however, i could not figure out how can individually handle cell data. Thanks for your help in advance.

e.g My table looks like the following

|col1 (string) | col2 (png image) | col3(string)| |col1 (string) | empty | col3(string)| |col1 (string) | col2 (png image) | col3(string)|

1

1 Answers

0
votes

If you are having trouble with this pdfmaker you can try the jsPDF as well. The jsPDF allows you to put images and strings and organize them by coords.

The problem is that I couldn't export the table itself to the pdf, instead I drew a "table" using lines that the jsPDF disponibilize.

Here is all you need to learn jsPDF: jsPDF - HTML5 PDF

EDIT:

It's important to know that to put images in the pdf you need to use them in base64. There is an example on the site and it's really simple.

You can use this site to convert your images to base64.