is there any way to find text using dimensions using pymupdf?

Question:

import fitz

doc = fitz.open(""

List item

)

for page in doc:
print(page.search_for("Bank Account"))

this program is for get dimensions of given text. i want to do reverse of it, find text using its dimensions.

Asked By: chintan bhimani

||

Answers:

import fitz

doc = fitz.open("")

rect = fitz.Rect(value) #add dimension in place of value

for page in doc: 
  print(page.get_textbox(rect))
Answered By: chintan bhimani

1.) First get the rectangular coordinates rect(x_0,y_0,x_1,y_1) of the text you want to extract.

2.) Use the syntax Page.get_text("text",clip=rect). Place you rectangular coordinates into the clip.

For more go to the link.

Answered By: Mohit Mehlawat
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.