()
| 662 | |
| 663 | |
| 664 | def test_extendable_textpage(): |
| 665 | |
| 666 | # 2025-01-28: |
| 667 | # |
| 668 | # We can create a pdf with two pages whose text is adjacent when stitched |
| 669 | # together vertically: |
| 670 | # |
| 671 | # Page 1: |
| 672 | # |
| 673 | # aaaa |
| 674 | # |
| 675 | # bbbb |
| 676 | # cccc |
| 677 | # |
| 678 | # dddd |
| 679 | # |
| 680 | # Page 2: |
| 681 | # |
| 682 | # eeee |
| 683 | # |
| 684 | # ffff |
| 685 | # gggg |
| 686 | # |
| 687 | # hhhh |
| 688 | # |
| 689 | # |
| 690 | # Create a textpage for both of these pages. Then when extracting text, |
| 691 | # we need to get (specifically the `dddd` and `eeee` sequences need to be |
| 692 | # treated as the same block): |
| 693 | # |
| 694 | # aaaa |
| 695 | # |
| 696 | # bbbb |
| 697 | # cccc |
| 698 | # |
| 699 | # dddd |
| 700 | # eeee |
| 701 | # |
| 702 | # ffff |
| 703 | # gggg |
| 704 | # |
| 705 | # hhhh |
| 706 | # |
| 707 | print() |
| 708 | |
| 709 | path = os.path.normpath(f'{__file__}/../../tests/test_extendable_textpage.pdf') |
| 710 | with pymupdf.open(filetype='pdf') as document: |
| 711 | document.new_page() |
| 712 | document.new_page() |
| 713 | page0 = document[0] |
| 714 | page1 = document[1] |
| 715 | y = 100 |
| 716 | line_height = 9.6 |
| 717 | for i in range(4): |
| 718 | page0.insert_text((100, y+line_height), 'abcd'[i] * 16) |
| 719 | page1.insert_text((100, y+line_height), 'efgh'[i] * 16) |
| 720 | y += line_height |
| 721 | if i%2 == 0: |
nothing calls this directly
no test coverage detected
searching dependent graphs…