save as pdf
by Emmanuel Garcia
HTML
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js" integrity="sha512-bLT0Qm9VnAYZDflyKcBaQ2gg0hSYNQrJ8RilYldYQ1FxQYoCLtUjuuRuZo+fjqhx/qtq/1itJ0C2ejDxltZVFg==" crossorigin="anonymous"></script>
</head>
<body>
<form id="form1">
<div id="dvContainer">
<img src="https://drive.google.com/uc?id=1i85nT5zFO-X2VB29wobGlmt7wxXyhLYK">
Your HTML content which needs to be printed
</div>
<input type="button" value="Print Contents" id="PrintNow" />
</form>
<script>
$("#PrintNow").on("click", function () {
var divContents = $("#dvContainer").html();
var printWindow = window.open('', '', 'height=400,width=800');
printWindow.document.write('<html><head><title>DIV Contents</title>');
printWindow.document.write('</head><body >');
printWindow.document.write(divContents);
printWindow.document.write('</body></html>');
printWindow.document.close();
printWindow.print();
});
</script>
</body>
</html>