Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

114
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda