-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open
Description
I use html2pdf.js with the following code:
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.9.2/html2pdf.bundle.min.js"></script>
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js" integrity="sha512-GsLlZN/3F2ErC5ifS5QtgpiJtWd43JWSuIgh7mbzZ8zBps+dvLusV+eNQATqgA/HdeKFVgA5v3S/cIrLF7QnIg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> -->
</head>
<body >
<button id="download">Download PDF</button>
<div id="report">
<h1>Header</h1>
<p>
Some Text
</p>
<img src="https://assets.ubuntu.com/v1/d639b982-canonical-brand-tile.png">
<p>
Above this text is a PNG picture, below a JPG picture.
</p>
<img src="https://image-tc.galaxy.tf/wijpeg-esipt0y72wzich0blxcn0h1x1/cmh-snow-2.jpg">
</div>
<script>
document.getElementById('download').addEventListener('click', () => {
const element = document.getElementById('report');
const options = {
margin: 0.05,
filename: 'report.pdf',
enableLinks: true,
html2canvas: { scale: 1, useCORS: true },
jsPDF: { unit: 'in', format: 'letter', orientation: 'portrait', compressPDF: true}
};
html2pdf()
.from(element)
.set(options)
.save();
});
</script>
</body>
</html>
But the PNG images are not shown. JPG images are. I tried all kinds of suggestions metioned in other issues without effect.
Metadata
Metadata
Assignees
Labels
No labels