page.add_highlight_annot(start=pointa, stop=pointb) not working #2168
-
Hello, i'm trying to highlight a text in a pdf from a start word "pointa" to an end word "pointb" but it wont work it will mark all the text on the page Maybe some one could help me (pleas) and figure out what i'm doing wrong. `import fitz
FindTextblock()` test file: Thank you |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 11 replies
-
@kalimer00 - welcome and hello again! |
Beta Was this translation helpful? Give feedback.
-
This script is even a bit simpler: import fitz
doc = fitz.open("test_source.pdf")
for page in doc:
rl1 = page.search_for("Therapievorschlag")
if rl1 == []: # not on page
continue
rl2 = page.search_for("EU-Verordnung")
if rl2 == []: # not on page
continue
pointa = rl1[0].tl
pointb = rl2[0].br
page.add_highlight_annot(start=pointa, stop=pointb)
doc.save("test.pdf") |
Beta Was this translation helpful? Give feedback.
-
There is no way to help without reproducible, sorry. Maybe to clarify a few questions:
|
Beta Was this translation helpful? Give feedback.
This script is even a bit simpler: