0

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.

2 Answers2

1

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.

Mohit Mehlawat
  • 344
  • 3
  • 6
-1
import fitz

doc = fitz.open("")

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

for page in doc: 
  print(page.get_textbox(rect))
Tyler2P
  • 2,324
  • 26
  • 22
  • 31
  • Your answer could be improved by adding more information on what the code does and how it solves the problem. – Tyler2P Oct 16 '22 at 10:27