Test save option "use_objstms". This option compresses PDF object definitions into a special object type "ObjStm". We test its presence by searching for that /Type.
()
| 24 | |
| 25 | |
| 26 | def test_objectstream2(): |
| 27 | """Test save option "use_objstms". |
| 28 | This option compresses PDF object definitions into a special object type |
| 29 | "ObjStm". We test its presence by searching for that /Type. |
| 30 | """ |
| 31 | # make some arbitrary page with content |
| 32 | text = "Hello, World! Hallo, Welt!" |
| 33 | doc = pymupdf.open() |
| 34 | page = doc.new_page() |
| 35 | rect = (50, 50, 200, 500) |
| 36 | |
| 37 | page.insert_htmlbox(rect, text) # place into the rectangle |
| 38 | _ = doc.write(use_objstms=False) |
| 39 | |
| 40 | found = False |
| 41 | for xref in range(1, doc.xref_length()): |
| 42 | objstring = doc.xref_object(xref, compressed=True) |
| 43 | if "/Type/ObjStm" in objstring: |
| 44 | found = True |
| 45 | break |
| 46 | assert not found, "Unexpected: Object stream found!" |
| 47 | |
| 48 | |
| 49 | def test_objectstream3(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…