Use TextWriter for text insertion.
()
| 62 | |
| 63 | |
| 64 | def test_textbox3(): |
| 65 | """Use TextWriter for text insertion.""" |
| 66 | doc = pymupdf.open() |
| 67 | page = doc.new_page() |
| 68 | font = pymupdf.Font("cjk") |
| 69 | rect = pymupdf.Rect(50, 50, 400, 400) |
| 70 | blue = (0, 0, 1) |
| 71 | tw = pymupdf.TextWriter(page.rect, color=blue) |
| 72 | tw.fill_textbox( |
| 73 | rect, |
| 74 | text, |
| 75 | align=pymupdf.TEXT_ALIGN_LEFT, |
| 76 | font=font, |
| 77 | fontsize=12, |
| 78 | right_to_left=True, |
| 79 | ) |
| 80 | tw.write_text(page, morph=(rect.tl, pymupdf.Matrix(1, 1))) |
| 81 | # check text containment |
| 82 | assert page.get_text() == page.get_text(clip=rect) |
| 83 | doc.scrub() |
| 84 | doc.subset_fonts() |
| 85 | |
| 86 | |
| 87 | def test_textbox4(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…