angularjspdfangular13

jsPDF removes spaces when using css font-weight bold


When I use font-weight bold jspdf makes the text lose spaces. See before and after pic below taken from the generated pdf. enter image description here

The code of jsPDF is below.

html inside typescript:

<table style="width: 1100px; background: #5ba8da;padding:10px;">  <tbody>
    <tr><td>Project Name: ${row.project} </td> </tr>
</table>

Typescript:

 let doc = new jsPDF('l', 'pt', 'a3');
 doc.setFont('courier');
 doc.html(this.template.body.summary(row), {
      x: 50, y: 65,
      callback: (doc) => {
        this.addFooter(doc);
        this.pdfSrc = doc.output("blob");
        this.busy = false;
      }
    });

Solution

  • After debugging all components and libraries, I found that th, td style was applied to a component that affected the style in pdf output. To solve the issue, I added the class of the other table so that it does not affect the pdf output css.