Use TextWriter for text insertion.
()
| 23 | # codespell:ignore-end |
| 24 | |
| 25 | def test_textbox1(): |
| 26 | """Use TextWriter for text insertion.""" |
| 27 | doc = pymupdf.open() |
| 28 | page = doc.new_page() |
| 29 | rect = pymupdf.Rect(50, 50, 400, 400) |
| 30 | blue = (0, 0, 1) |
| 31 | tw = pymupdf.TextWriter(page.rect, color=blue) |
| 32 | tw.fill_textbox( |
| 33 | rect, |
| 34 | text, |
| 35 | align=pymupdf.TEXT_ALIGN_LEFT, |
| 36 | fontsize=12, |
| 37 | ) |
| 38 | tw.write_text(page, morph=(rect.tl, pymupdf.Matrix(1, 1))) |
| 39 | # check text containment |
| 40 | assert page.get_text() == page.get_text(clip=rect) |
| 41 | page.write_text(writers=tw) |
| 42 | |
| 43 | |
| 44 | def test_textbox2(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…