I have been battling with Google and the limited documentation of PDFMiner for the last several hours, and although I feel close, I\'m just not getting what I need. I\'ve worke
I was able to find my way around pdfminer thanks to some code by Denis Papathanasiou. The code is discussed in his blog, and you can find the source here: layout_scanner.py
In particular, take a look at the method parse_lt_objs( ). In the final loop, k should be a pair containing the coordinates of that bit of text (and it is discarded). I don't have a working coordinate extractor to post here (I was not interested in them), but it sounds like you'll have no trouble finding your way from there.
Good luck with it!
I've been writing a library to try to simplify this process, pdfquery. To extract text from a particular place in a particular page, you would do:
pdf = pdfquery.PDFQuery(file)
# load first, third, fourth pages
pdf.load(0, 2, 3)
# find text between 100 and 300 points from left bottom corner of first page
text = pdf.pq('LTPage[page_index=0] :in_bbox("100,100,300,300")').text()
# save tree as XML to try to figure out why the last line didn't work the way you expected :)
pdf.tree.write(filename, pretty_print=True)
If you want to find individual characters within that box, instead of text lines entirely within that box, pass merge_tags=None to PDFQuery (by default it merges consecutive characters into a single element to make the tree less ridiculous, so the whole line would have to be inside the box). If you want to find anything that partially overlaps the box, use :overlaps_bbox instead of :in_bbox.
This is basically using PyQuery selector syntax to grab text from a PDFMiner layout, so if your document is too messy for PDFMiner, it may be too messy for this as well, but at least it will be faster to play with.