Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
@@ -327,9 +327,9 @@ def display_highlighted_pdf(file_path, text_to_highlight):
|
|
327 |
|
328 |
# Create a highlight annotation for each area
|
329 |
for area in areas:
|
330 |
-
highlight_rect =
|
331 |
highlight_annot = page.add_highlight_annot(highlight_rect) #fitz.Annot(page.parent, highlight_rect, annot_type=fitz.PDF_ANNOT_HIGHLIGHT)
|
332 |
-
highlight_annot.set_colors({"stroke":
|
333 |
highlight_annot.update()
|
334 |
# page.add_annot(highlight_annot)
|
335 |
|
@@ -487,7 +487,7 @@ def highlight_pdf(file_path, text_to_highlight, page_numbers):
|
|
487 |
# Example usage
|
488 |
|
489 |
def pdf_to_images(pdf_path, page_numbers):
|
490 |
-
doc =
|
491 |
images = []
|
492 |
for page_number in page_numbers:
|
493 |
page = doc.load_page(page_number - 1)
|
|
|
327 |
|
328 |
# Create a highlight annotation for each area
|
329 |
for area in areas:
|
330 |
+
highlight_rect = pymupdf.Rect(area)
|
331 |
highlight_annot = page.add_highlight_annot(highlight_rect) #fitz.Annot(page.parent, highlight_rect, annot_type=fitz.PDF_ANNOT_HIGHLIGHT)
|
332 |
+
highlight_annot.set_colors({"stroke": pymupdf.utils.getColor("yellow")})
|
333 |
highlight_annot.update()
|
334 |
# page.add_annot(highlight_annot)
|
335 |
|
|
|
487 |
# Example usage
|
488 |
|
489 |
def pdf_to_images(pdf_path, page_numbers):
|
490 |
+
doc = pymupdf.open(pdf_path)
|
491 |
images = []
|
492 |
for page_number in page_numbers:
|
493 |
page = doc.load_page(page_number - 1)
|