dom-to-image export error when there is a value between 10-20

this is my first question, so if I didn’t explain the problem correctly, I’d appreciate any feedback.

Issue: I’m using the following code to export a PDF, but when %{Math.abs(differenceView)} has a value between 10 and 20, dom-to-image throws an error.

Code:

const downloadPdf = async () => {
    domtoimage.toJpeg(document.getElementById('htmlToPdf'), { quality: 0.95 })
      .then(function (dataUrl) {
        var img = new Image();
        img.src = dataUrl;
        img.onload = function () {
          console.log(img)
          var pdf = new jsPDF();
          var width = pdf.internal.pageSize.getWidth();
          var height = pdf.internal.pageSize.getHeight();
          pdf.addImage(img, 'JPEG', 0, 0, width, height);
          pdf.save('my-pdf-name.pdf');
        };
      })
      .catch(function (error) {
        console.error('Error:', error);
      });
}
<div className="-graphic-ratio">
    <div className="graphic-ratio-div">
        <label className={
            `chart-subtitle ${differenceView > 0
                ? 'label-positive'
                : differenceView === 0
                ? 'label-neutral'
                : 'label-negative'
            }`
        }>
            %{Math.abs(differenceView) || 0}
        </label>
    </div>
</div>

Problem: When the differenceView value is between 10 and 20, dom-to-image produces an error. Does anyone know why this is happening and how to fix it?

Thanks!