I tried making a button convert my HTML page into a PDF and downloads it, but I can't get it to work. For example, if this is the page:
function download() {
print()
}
<html>
<body>
<h2>Page Content</h2>
<br>
<p>The page content will go <span style="color:red;">here...</span></p>
<br><br>
<button onclick="download()">Download Page</button><br>
^ The above button uses the <code>print()</code> function. However, this prompts the user with a print page, instead of asking to download.
</body>
</html>
print()
function, however that asks the user to print the page, not download it.
Does anyone know how I can convert the HTML page to a pdf for download?