Spaces:
Runtime error
Runtime error
Update templates/gui.html
Browse files- templates/gui.html +68 -2
templates/gui.html
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
<!DOCTYPE html>
|
| 2 |
<html lang="en">
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
|
@@ -56,4 +56,70 @@ processPdf();
|
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
-
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!-- <!DOCTYPE html>
|
| 2 |
<html lang="en">
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
|
|
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
+
</script> -->
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
<!DOCTYPE html>
|
| 63 |
+
<html lang="en">
|
| 64 |
+
<head>
|
| 65 |
+
<meta charset="UTF-8">
|
| 66 |
+
<title>PDF Viewer</title>
|
| 67 |
+
<style>
|
| 68 |
+
body { margin: 0; padding: 0; font-family: sans-serif; }
|
| 69 |
+
#pdfViewer { width: 100vw; height: 100vh; border: none; }
|
| 70 |
+
#links {
|
| 71 |
+
position: fixed;
|
| 72 |
+
top: 10px;
|
| 73 |
+
left: 10px;
|
| 74 |
+
background: rgba(255, 255, 255, 0.9);
|
| 75 |
+
padding: 8px 12px;
|
| 76 |
+
border-radius: 10px;
|
| 77 |
+
box-shadow: 0 0 6px rgba(0,0,0,0.2);
|
| 78 |
+
}
|
| 79 |
+
.pdf-link {
|
| 80 |
+
display: block;
|
| 81 |
+
margin: 6px 0;
|
| 82 |
+
cursor: pointer;
|
| 83 |
+
color: #0056b3;
|
| 84 |
+
text-decoration: underline;
|
| 85 |
+
}
|
| 86 |
+
</style>
|
| 87 |
+
</head>
|
| 88 |
+
<body>
|
| 89 |
+
<div id="links"></div>
|
| 90 |
+
|
| 91 |
+
<!-- The iframe viewer -->
|
| 92 |
+
<iframe
|
| 93 |
+
id="pdfViewer"
|
| 94 |
+
src="/get-pdf#page={{ start_page }}&zoom={{ start_zoom }}"
|
| 95 |
+
allowfullscreen
|
| 96 |
+
></iframe>
|
| 97 |
+
|
| 98 |
+
<script>
|
| 99 |
+
// Example: links that might come from an external source (you can replace this array)
|
| 100 |
+
const generatedLinks = [
|
| 101 |
+
{ page: 2, zoom: 150 },
|
| 102 |
+
{ page: 5, zoom: 125 },
|
| 103 |
+
{ page: 10, zoom: 200 },
|
| 104 |
+
{ page: 15, zoom: 180 }
|
| 105 |
+
];
|
| 106 |
+
|
| 107 |
+
const container = document.getElementById('links');
|
| 108 |
+
const pdfViewer = document.getElementById('pdfViewer');
|
| 109 |
+
|
| 110 |
+
// Create clickable redirect links dynamically
|
| 111 |
+
generatedLinks.forEach(item => {
|
| 112 |
+
const link = document.createElement('a');
|
| 113 |
+
link.textContent = `Go to Page ${item.page} (Zoom ${item.zoom}%)`;
|
| 114 |
+
link.className = 'pdf-link';
|
| 115 |
+
link.href = '#';
|
| 116 |
+
link.addEventListener('click', e => {
|
| 117 |
+
e.preventDefault();
|
| 118 |
+
// Redirect existing iframe — no new tab, no reprocessing
|
| 119 |
+
pdfViewer.src = `/get-pdf#page=${item.page}&zoom=${item.zoom}`;
|
| 120 |
+
});
|
| 121 |
+
container.appendChild(link);
|
| 122 |
+
});
|
| 123 |
+
</script>
|
| 124 |
+
</body>
|
| 125 |
+
</html>
|