Test ez_save(). Should automatically use object streams
()
| 47 | |
| 48 | |
| 49 | def test_objectstream3(): |
| 50 | """Test ez_save(). |
| 51 | Should automatically use object streams |
| 52 | """ |
| 53 | import io |
| 54 | |
| 55 | fp = io.BytesIO() |
| 56 | |
| 57 | # make some arbitrary page with content |
| 58 | text = "Hello, World! Hallo, Welt!" |
| 59 | doc = pymupdf.open() |
| 60 | page = doc.new_page() |
| 61 | rect = (50, 50, 200, 500) |
| 62 | |
| 63 | page.insert_htmlbox(rect, text) # place into the rectangle |
| 64 | |
| 65 | doc.ez_save(fp) # save PDF to memory |
| 66 | found = False |
| 67 | for xref in range(1, doc.xref_length()): |
| 68 | objstring = doc.xref_object(xref, compressed=True) |
| 69 | if "/Type/ObjStm" in objstring: |
| 70 | found = True |
| 71 | break |
| 72 | assert found, "No object stream found!" |
nothing calls this directly
no test coverage detected
searching dependent graphs…