parallax / jsPDF

Client-side JavaScript PDF generation for everyone.

Home Page:https://parall.ax/products/jspdf

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jsPDF.html truncates some whitespace characters from each element

geoidesic opened this issue · comments

jsPDF v 2.5.1

const pdf = new jsPDF('p', 'pt', 'a4');

  pdf.html('<h1>How to Train Your Dragon</h1>', {
    callback: function (doc) {
      pdf.save(`${journal.name}.pdf`);
    },
    autoPaging: 'text',
    jsPDF: pdf,
    windowWidth: 600,
    width: 600
  });
  

The output in the PDF is "Howto TrainYourDragon". Note the missing spaces between some words.

Similar problems reported by other users: https://stackoverflow.com/questions/69705309/jspdf-html2canvas-losing-spaces-and-misaligning-text-generally