How to add gif images in datatable pdf and excel.

How to add gif images in datatable pdf and excel.

Muhammad ShoaibMuhammad Shoaib Posts: 3Questions: 2Answers: 0

I want to add gif images in excel and pdf of data tables. Other images are added successfully in pdf but went I try to add gif images in pdf it gives me errors and continuous loading.

Answers

  • Muhammad ShoaibMuhammad Shoaib Posts: 3Questions: 2Answers: 0
    edited February 2022

    This is my code to add images in pdf

    customize: function (doc) {
                    var imageMap = $('.wareMapIcon').map(function(){
                      return this.src;
                    }).get();
    
                    var imageUser = $('.wareUserImage').map(function(){
                      return this.src;
                    }).get();
    
    
    
                    for (var i = 0, c = 1; i < imageMap.length; i++, c++) {
                        doc.content[2].table.body[c][4] = {
                            image: imageMap[i],
    
                            width: 25,
                            height: 25,
                        }
                    }
    
    
                    for (var i = 0, c = 1; i < imageUser.length; i++, c++) {
    
                        doc.content[2].table.body[c][13] = {
                            image: imageUser[i],
                            alignment: "center",
                            width: 25,
                            height: 25,
                        }
                    }
    
                },
    
  • colincolin Posts: 14,618Questions: 1Answers: 2,497

    This thread might help. If not, we're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • allanallan Posts: 57,737Questions: 1Answers: 9,204 Site admin

    Our export functions do not support image export at this time. You'd be best asking the pdfmake folks (whose library we use for the pdf export) for instructions on how to embed gif images into a pdf.

    Allan

Sign In or Register to comment.