Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

515
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda