Highlight pdf #2139
Answered
by
JorjMcKie
maivan-hoa
asked this question in
Q&A
Highlight pdf
#2139
-
I highlight the pdf file, but the result is not as smooth as expected. Has anyone encountered this error before? Here is my code: list_text = ["Tiếng Việt được chính thức ghi nhận trong Hiến pháp nước Cộng hòa xã hội chủ nghĩa Việt Nam 2013, tại Chương I Điều 5
Mục 3, là ngôn ngữ quốc gia của Việt Nam .", "Tôi rất mong nhận được sự góp ý, đánh giá của các thầy cô bộ môn để đề tài
của tôi thêm hoàn thiện hơn."]
doc = fitz.open(input_file)
for page in doc:
for text in list_text:
### SEARCH
text_instances = page.search_for(text, quads=True)
### HIGHLIGHT
for inst in text_instances:
highlight = page.add_highlight_annot(inst)
doc.save(output_file, garbage=4, deflate=True, clean=True) |
Beta Was this translation helpful? Give feedback.
Answered by
JorjMcKie
Dec 17, 2022
Replies: 3 comments 7 replies
-
And what is the error? The code does what you told it to do. Don't understand why you use You did not mention your version. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Let me convert this to a "Discussions" item. You seem to have questions - as opposed to reporting an issue. |
Beta Was this translation helpful? Give feedback.
7 replies
Answer selected by
JorjMcKie
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Let me convert this to a "Discussions" item. You seem to have questions - as opposed to reporting an issue.