Skip to content
Discussion options

You must be logged in to vote

Test 1:

In [1]: import fitz
In [2]: doc=fitz.open("bad stamp example.pdf")
In [3]: page=doc[0]
In [4]: page.wrap_contents()
In [5]: xref = page.insert_image((0, 0, 400, 200), filename="nur-ruhig.png")
In [6]: # save PDF to memory and re-open:
In [7]: pdfdata = doc.tobytes(deflate=True)
In [8]: doc.close()
In [9]: doc = fitz.open("pdf", pdfdata)
In [10]: page = doc[0]
In [11]: page.get_image_rects(xref)
Out[11]: [Rect(112.375244140625, 0.0, 287.624755859375, 200.0)]
In [12]: # PERFECT!!!

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by said46
Comment options

You must be logged in to vote
1 reply
@JorjMcKie
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants