Comment convertir HTML en JPG

<html>
<body>
<style>
.container {
  margin-top: 10px;
  border: solid 1px black;
}
</style>

<script>
function report() {
  let region = document.querySelector("body"); // whole screen
  html2canvas(region, {
    onrendered: function(canvas) {
      let pngUrl = canvas.toDataURL(); // png in dataURL format
      let img = document.querySelector(".screen");
      img.src = pngUrl; 

      // here you can allow user to set bug-region
      // and send it with 'pngUrl' to server
    },
  });
}
</script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.4.1/html2canvas.min.js"></script>
<div>Write your content here...

<p>After you get the output, right-click it and save it to your device</p></div>
<button onclick="report()">Convert to Jpg</button>
<div class="container">
  <img width="75%" class="screen">
</div>

</body>
</html>
Thomas coder