I am trying to generate a PDF with html2canvas but when calling the function I throw an error, my TS is the following:
  @ViewChild('content') content:ElementRef;
  generarPDF() {
    html2canvas(document.getElementById('content'), {
      // Opciones
      allowTaint: true,
      useCORS: false,
      // Calidad del PDF
      scale: 1
    }).then(function(canvas) {
      var img = canvas.toDataURL("image/png");
      var doc = new jsPDF();
      doc.addImage(img,'PNG',7, 20, 195, 105);
      doc.save('postres.pdf');
    });
  }
My html is:
div.cliente {
    border-bottom: 2px dotted;
    width: 70%;
    float: left;
}
div.fecha {
    border-bottom: 2px dotted;
    width: 28%;
    float: right;
}
ul.satisfacion {
    float: left;
    margin-top: 28px;
}  <div #content id="content">
    <div class="contenido-pdf">
     
      <div class="cliente">
        <span>Cliente: </span>
        <div class="campo"></div>
      </div>
      <div class="fecha">
          <span>Fecha: </span>
          <div class="campo"></div>
        </div>
      <ul class="satisfacion">
        <li>El servicio es muy satisfactorio</li>
        <li>El servicio es satisfactorio</li>
        <li>El servico es normal</li>
        <li>El servicio no es satisfactorio</li>
      </ul>
    </div>
  </div>
  <button mat-raised-button (click)="generarPDF()" id="donwloadpdf">
  DESCARGAR CARTA DE CONFORMIDAD
</button>And my error
ERROR Error: "Uncaught (in promise): Error: Supplied Data is not a valid base64-String jsPDF.convertStringToImageData 
e.convertStringToImageData
When I am going to click on generate pdf it does not generate it or do anything, it just throws that error on my console, I already tried to generate it with jsPDF but the problem is that it does not preserve the styles
 
     
    