Repository navigation
Commit 0571b61
BUG: Fix set_page_label TypeError when start=None (#4286)
* ROB: Tolerate extra operands before Tm/cm in layout mode
A matrix operator consumes the 6 operands nearest to it; values
left on the operand stack before those (malformed content streams)
overflowed TextStateManager.new_transform() and raised TypeError
in layout mode text extraction.
Complete the matrix with only the last 6 operands in
_complete_matrix and add_cm, mirroring the tolerance already in
place for missing/non-numeric TD and Tz operands (#4232, #4233).
Fixes #4283
Co-authored-by: rahul05ranjan <11793455+rahul05ranjan@users.noreply.github.com>
* Fix set_page_label TypeError when start=None
The start parameter is annotated Optional[int] and its validation
accepts None as "not set", but _set_page_label used ,
which treats None as a value to write and crashes in NumberObject.
Only write /St when a concrete non-zero start was provided.
Fixes #4285
Co-authored-by: rahul05ranjan <11793455+rahul05ranjan@users.noreply.github.com>
* Add tests for set_page_label with start=None
Co-authored-by: rahul05ranjan <11793455+rahul05ranjan@users.noreply.github.com>
* Update tests/test_writer.py
* Update tests/test_writer.py
---------
Co-authored-by: rahul05ranjan <11793455+rahul05ranjan@users.noreply.github.com>
Co-authored-by: Stefan <96178532+stefan6419846@users.noreply.github.com>1 parent 694aa59 commit 0571b61
2 files changed
Lines changed: 33 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3460 | 3460 | | |
3461 | 3461 | | |
3462 | 3462 | | |
3463 | | - | |
| 3463 | + | |
3464 | 3464 | | |
3465 | 3465 | | |
3466 | 3466 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1769 | 1769 | | |
1770 | 1770 | | |
1771 | 1771 | | |
| 1772 | + | |
| 1773 | + | |
| 1774 | + | |
| 1775 | + | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
| 1789 | + | |
| 1790 | + | |
| 1791 | + | |
| 1792 | + | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
| 1796 | + | |
| 1797 | + | |
| 1798 | + | |
| 1799 | + | |
| 1800 | + | |
| 1801 | + | |
| 1802 | + | |
| 1803 | + | |
1772 | 1804 | | |
1773 | 1805 | | |
1774 | 1806 | | |
| |||
0 commit comments