How to display image from data in column
See original GitHub issueHi Man, I have an image in column, how to show it?
this is : var doc = new jsPDF(‘p’, ‘pt’,‘letter’); var elem = document.getElementById(“tbl-customers”); var res = doc.autoTableHtmlToJson(elem); doc.autoTable(res.columns, res.data, {
drawRow: function (row, data) {
var logo = row.index === 7;
var Imgpath = '$baseurl/upload/'+ logo;
if (row.index === 7) {
doc.addImage(Imgpath, 'JPEG', data.settings.margin.left, 40, 25, 25);
}
}
});
doc.save("table.pdf");
please help, thanks
Issue Analytics
- State:
- Created 8 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
How to: Display Images from a Data Field with Image Paths
#Create and Assign the PictureEdit to the Image Column · C# · VB.NET.
Read more >Display images in a table or matrix in a report - Power BI
Select that column. On the Column tools ribbon, for Data category, select Image URL. ... Add the column to a table, matrix, slicer,...
Read more >How to display image in column; — DataTables forums
I would like to render an image based on the URL of the image file displayed in the column. <img src="url/image.jpg">.
Read more >Display images in columns and measures in Power BI table ...
(a) Configure the measure or the column you're going to use (b) Select ' Image URL' in the Data category (c) Image URL...
Read more >Display images in a table column with data - Stack Overflow
I am working on firebase cloudfirestore and I want to display image in a table column with data. Currently I have tried to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It can be done something like this. Here is a working codepen. Note that I used src=“datauri” in the html, but it should work with normal urls as well as long as they are local.
I realized while writing this that the hooks system needs some work to be user friendly. I also found a bug that meant that I had to add the images in the
afterPageContent
hook instead of directly indrawCell
as it otherwise got hidden below the table.Hi simonbengtsson, How can i show dynamic image & data in pdf if i have data in array format currently it will generate the imageUrl in pdf sample dynamic data responseHeader : [[‘No’,‘avatarImage’,‘rationNo’,‘color’]]
responseData 0:[‘1’,‘https://www.w3schools.com/howto/img_avatar.png’,‘3455’,'red’] 1:[‘12’,‘https://www.w3schools.com/howto/img_avatar.png’,‘34’,'blue’]
generategeneratePdf (responseHeader,responseData)
const generatePdf = (responseHeader,responseData) => { const doc = new jsPDF(‘p’,‘pt’); doc.autoTable({ head: responseHeader, body: responseData, }) doc.save(‘table.pdf’); }