Spaces:
Sleeping
Sleeping
Update Find_Hyperlinking_text.py
Browse files- Find_Hyperlinking_text.py +7 -15
Find_Hyperlinking_text.py
CHANGED
|
@@ -84,15 +84,10 @@ def save_df_to_pdf(df):
|
|
| 84 |
pdf.ln(max_height)
|
| 85 |
# Save PDF to memory instead of a file
|
| 86 |
# pdf_output = BytesIO()
|
| 87 |
-
pdf
|
|
|
|
| 88 |
|
| 89 |
-
|
| 90 |
-
# pdf_output.seek(0)
|
| 91 |
-
|
| 92 |
-
# # Open the PDF using fitz (PyMuPDF) directly from the BytesIO object
|
| 93 |
-
# outputpdfFitz = fitz.open(pdf_output)
|
| 94 |
-
|
| 95 |
-
# return outputpdfFitz
|
| 96 |
|
| 97 |
|
| 98 |
|
|
@@ -386,12 +381,9 @@ def annotate_text_from_pdf(pdfshareablelinks, LISTheading_to_search):
|
|
| 386 |
all_text += current_line.strip() + '\n' # Append the current line
|
| 387 |
print(df)
|
| 388 |
print(dictionaryNBS)
|
| 389 |
-
|
| 390 |
-
|
| 391 |
-
# outputpdfFitz =fitz.open('pdf',outputpdf)
|
| 392 |
-
# Save the annotated PDF to bytes
|
| 393 |
pdf_bytes = BytesIO()
|
| 394 |
pdf_document.save(pdf_bytes)
|
| 395 |
-
|
| 396 |
-
|
| 397 |
-
return pdf_bytes.getvalue(), pdf_document , df
|
|
|
|
| 84 |
pdf.ln(max_height)
|
| 85 |
# Save PDF to memory instead of a file
|
| 86 |
# pdf_output = BytesIO()
|
| 87 |
+
# pdf_output = 'output.pdf'
|
| 88 |
+
pdf_output = pdf.output(dest="S").encode("latin1") # Returns the PDF as a byte string
|
| 89 |
|
| 90 |
+
return pdf_output
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
|
| 92 |
|
| 93 |
|
|
|
|
| 381 |
all_text += current_line.strip() + '\n' # Append the current line
|
| 382 |
print(df)
|
| 383 |
print(dictionaryNBS)
|
| 384 |
+
xx=save_df_to_pdf(df)
|
| 385 |
+
outputpdfFitz =fitz.open('pdf',xx)
|
|
|
|
|
|
|
| 386 |
pdf_bytes = BytesIO()
|
| 387 |
pdf_document.save(pdf_bytes)
|
| 388 |
+
return pdf_bytes.getvalue(), pdf_document , df,outputpdfFitz
|
| 389 |
+
|
|
|