MCPcopy Create free account
hub / github.com/pymupdf/PyMuPDF / test_insert

Function test_insert

tests/test_insertimage.py:15–27  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

13
14
15def test_insert():
16 doc = pymupdf.open()
17 page = doc.new_page()
18 r1 = pymupdf.Rect(50, 50, 100, 100)
19 r2 = pymupdf.Rect(50, 150, 200, 400)
20 page.insert_image(r1, filename=imgfile)
21 page.insert_image(r2, filename=imgfile, rotate=270)
22 info_list = page.get_image_info()
23 assert len(info_list) == 2
24 bbox1 = pymupdf.Rect(info_list[0]["bbox"])
25 bbox2 = pymupdf.Rect(info_list[1]["bbox"])
26 assert bbox1 in r1
27 assert bbox2 in r2
28
29def test_compress():
30 document = pymupdf.open(f'{scriptdir}/resources/2.pdf')

Callers

nothing calls this directly

Calls 3

new_pageMethod · 0.80
insert_imageMethod · 0.80
get_image_infoMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…