Marthee commited on
Commit
b650d52
·
verified ·
1 Parent(s): 40dd521

Update templates/gui.html

Browse files
Files changed (1) hide show
  1. templates/gui.html +6 -4
templates/gui.html CHANGED
@@ -8,17 +8,19 @@
8
  <body>
9
 
10
  <script>
11
- openPdf()
12
  function openPdf() {
13
- const page = {{ page }}
 
14
 
15
  if (page && parseInt(page) > 0) {
16
- // Open PDF on a new tab with Flask URL and the page number
17
- window.location.href=`/view-pdf#page=${page}`;
18
  } else {
19
  alert('Please enter a valid page number');
20
  }
21
  }
 
 
22
  </script>
23
 
24
  </body>
 
8
  <body>
9
 
10
  <script>
 
11
  function openPdf() {
12
+ // Ensure Flask passes a default value of 1 if page is not specified
13
+ const page = {{ page if page else 1 }}; // Pass `1` as a fallback value
14
 
15
  if (page && parseInt(page) > 0) {
16
+ // Open PDF on a new tab with Flask URL and the specified page number
17
+ window.location.href = `/view-pdf?page=${page}`;
18
  } else {
19
  alert('Please enter a valid page number');
20
  }
21
  }
22
+
23
+ openPdf(); // Call the function
24
  </script>
25
 
26
  </body>