# Extracting Text from a PDF Image Using Drawable Canvas

**URL:** <https://discuss.streamlit.io/t/extracting-text-from-a-pdf-image-using-drawable-canvas/112645>\
**Category:** Using Streamlit\
**Tags:** discussion\
**Created:** [May 15, 2025, 6:00pm UTC](https://discuss.streamlit.io/t/extracting-text-from-a-pdf-image-using-drawable-canvas/112645 "2025-05-15T18:00:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Okello](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/okello/32/63860_2.png) [@Okello](https://discuss.streamlit.io/u/Okello)\
**Post date:** [May 15, 2025, 6:00pm UTC](https://discuss.streamlit.io/t/extracting-text-from-a-pdf-image-using-drawable-canvas/112645/1 "2025-05-15T18:00:45Z")

</div>

Hi all! 👋

I’m building a Streamlit app that allows users to upload a PDF and interactively extract specific fields (like name, email, etc.). I use PyMuPDF (fitz) for reading and locating text, and PIL to render a zoomed image of the page with rectangles highlighting fields.

Here’s what works so far:

- I extract text fields using regex.

- I find the bounding box of labels using page.search\_for(“Field Label”).

- I render the PDF page as an image and draw rectangles around the label positions.

Is there a way in Streamlit to allow users to click directly on the canvas or image to extract the text within the triangle?

- Is this possible using st.canvas, streamlit-drawable-canvas, or another method?

If anyone has done something similar or has ideas, I’d really appreciate the input. Happy to share more code if needed!

Thanks in advance 🙏

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/streamlit/original/3X/c/f/cf4c2ee0d938358f82448c5fe4b9c3c91d7ce19c.svg) [@system](https://discuss.streamlit.io/u/system)\
**Post date:** [November 11, 2025, 6:00pm UTC](https://discuss.streamlit.io/t/extracting-text-from-a-pdf-image-using-drawable-canvas/112645/2 "2025-11-11T18:00:51Z")

</div>

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
