Spaces:
Sleeping
Sleeping
| <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> | |