Marthee's picture
Update templates/gui.html
12daac8 verified
raw
history blame contribute delete
810 Bytes
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>View PDF</title>
</head>
<body>
<script>
function openPdf() {
// Ensure Flask passes a default value of 1 if page is not specified
const page = {{ page if page else 1 }}; // Pass `1` as a fallback value
console.log(page)
if (page && parseInt(page) > 0) {
// Open PDF on a new tab with Flask URL and the specified page number
window.location.href = `/view-pdf#page=${page}`;
} else {
alert('Please enter a valid page number');
}
}
openPdf(); // Call the function
</script>
</body>
</html>