Skip to content

Commit

Permalink
tests/: added test for issue pymupdf#2270 with textbox annotation.
Browse files Browse the repository at this point in the history
  • Loading branch information
julian-smith-artifex-com committed Mar 13, 2023
1 parent eda3262 commit 1e2a7f0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Binary file added tests/resources/test_2270.pdf
Binary file not shown.
14 changes: 14 additions & 0 deletions tests/test_annots.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,17 @@ def test_1824():
doc=fitz.open(path)
page=doc[0]
page.apply_redactions()

def test_2270():
'''
https://github.com/pymupdf/PyMuPDF/issues/2270
'''
path = os.path.abspath( f'{__file__}/../resources/test_2270.pdf')
with fitz.open(path) as document:
for page_number, page in enumerate(document):
for textBox in page.annots(types=(fitz.PDF_ANNOT_FREE_TEXT,fitz.PDF_ANNOT_TEXT)):
print("textBox.type :", textBox.type)
print("textBox.get_text('words') : ", textBox.get_text('words'))
print("textBox.get_text('text') : ", textBox.get_text('text'))
print("textBox.get_textbox() : ", textBox.get_textbox(textBox.rect))
print("textBox.info['content'] : ", textBox.info['content'])

0 comments on commit 1e2a7f0

Please sign in to comment.