Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

513
Views
Add image in cell before text with JsPDF AutoTable

I want to put image before text in the same cell of this cell. But I don't know how to do. The images I try to put are never the same size. For the moment, I tried with a random image, but I don't know how to shift the text after the image. I'm not even sure that is possible. Here is a part of my code :

doc.autoTable({
                headStyles: { halign: 'center', fillColor: [0, 63, 204], lineWidth: 0.3, lineColor: [0, 0, 0] },
                columnStyles: {
                    0: { halign: 'center', cellWidth: 60, fillColor: [255, 255, 255], lineWidth: 0.3, lineColor: [0, 0, 0] },
                    1: { halign: 'center', cellWidth: 'auto', fillColor: [255, 255, 255], lineWidth: 0.3, lineColor: [0, 0, 0] }
                },
                didDrawCell: function (data) {
                    var img = "/Content/rtech/img/logo_black_blue.jpg"
                    var textPos = data.cell.getTextPos();
                    console.log(data.cell);
                    doc.addImage(img, 'JPEG', textPos.x, textPos.y, 50, 15); }]);
                   
                },
                html: '#facTableName-' + i
            })

In this case, I add this image in each row of the tab.

Hope you will be able to help me, thank you.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I resolved my problem by myself.

  1. What I needed to do is to add the image at the position of left border of the cell I wanted to put the image in.

  2. Then I set the minheight of the cell to the heigth of the pic.

  3. Finally, I set the left padding to size of picture.

  4. Now, I am able to have an image before the text.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!