Spaces:
Runtime error
Runtime error
Update InitialMarkups.py
Browse files- InitialMarkups.py +2 -1
InitialMarkups.py
CHANGED
|
@@ -50,12 +50,13 @@ def changepdflinks(json_data, pdf_path):
|
|
| 50 |
for entry in json_data:
|
| 51 |
# Extract needed fields
|
| 52 |
zoom_str = entry.get("NBSLink", "")
|
|
|
|
| 53 |
|
| 54 |
# Encode the pdf link safely for URL usage
|
| 55 |
encoded_pdf_link = urllib.parse.quote(pdf_path, safe='')
|
| 56 |
|
| 57 |
# Construct the final link
|
| 58 |
-
final_url = f"{base_viewer_link}pdfLink={encoded_pdf_link}#{zoom_str}"
|
| 59 |
|
| 60 |
# Replace the old NBSLink value with the full URL
|
| 61 |
entry["NBSLink"] = final_url
|
|
|
|
| 50 |
for entry in json_data:
|
| 51 |
# Extract needed fields
|
| 52 |
zoom_str = entry.get("NBSLink", "")
|
| 53 |
+
page_str=entry.get("Page","")
|
| 54 |
|
| 55 |
# Encode the pdf link safely for URL usage
|
| 56 |
encoded_pdf_link = urllib.parse.quote(pdf_path, safe='')
|
| 57 |
|
| 58 |
# Construct the final link
|
| 59 |
+
final_url = f"{base_viewer_link}pdfLink={encoded_pdf_link}#page={str(page_str)}&zoom={zoom_str}"
|
| 60 |
|
| 61 |
# Replace the old NBSLink value with the full URL
|
| 62 |
entry["NBSLink"] = final_url
|