html2canvas image height includes data-html2canvas-ignore

Viewed 109

So I have a code that gets the canvas image of a certain container and I'm using html2canvas to get the image and putting it on a PDF (jspdf). The method works but I'm having some problem on the canvas height. I'm using this data-html2canvas-ignore="true" to exclude an element that I don't want to include. The code works as expected but the canvas image's height is the same even if there's an excluded element. Is there a way to get the correct height of the canvas with this data-html2canvas-ignore="true"? Here's a small snippet I'm doing.

  html2canvas(input, {
    scale: 0.8
  }).then((canvas) => {
    const imgData = canvas.toDataURL('image/png');
    const { height, width } = canvas;

    ...
    // function to pass the image to the pdf
  });

Appreciate the help as I can't find a similar question to this post.

0 Answers
Related