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

104
Vistas
jsPDF convert sentence of tag p of html file to word in one column

I'm using jsPDF with my nuxt.js project where I fetch the html from API when the user clicks the Export button then converts the HTML to PDF before download. The HTML file that I got from API looks completely normal but after being converted with jsPDF and exporting out I didn't get the full sentence but rather a word by word in one column instead (like the image below). Could anyone please help me fine out where I did wrong. Bellow are my codes

HTML code

   <span
        class="btn"
        title="Export report"
        v-if="!isExporting"
        @click="exportReport"
        >Export Report</span
    >

Javascript

import html2canvas from "html2canvas";
import jsPDF from "jspdf";

downloadReport() {
    Service.getHTMLReport().then(response => {
        var doc = new jsPDF("p", "pt", "a4");
        let htmlFile = response;

        doc.html(htmlFile, {
        callback: function(pdf) {
            pdf.save("report.pdf");
        }
        });
    });
}

This is the HTML file I console from the response enter image description here

This is the PDF file after export out enter image description here

about 4 years ago · Juan Pablo Isaza
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