#๐Ÿ”’ PDF program to extract text from Scan PDFs

21 messages ยท Page 1 of 1 (latest)

hidden bridgeBOT
#

@rugged meadow

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

rugged meadow
#
import pytesseract
from pdf2image import convert_from_path
import glob

pdfs = glob.glob(f'/Users/Downloads/Example.pdf')
for pdf_path in pdfs:
    pages = convert_from_path(pdf_path, 500)
    for pageNum, imgBlob in enumerate(pages):
        text = pytesseract.image_to_string(imgBlob)
        with open(f'/Users/
Downloads/{pdf_path[:4]}__page__{pageNum}.txt', 'w') as the_file:
            the_file.write(text)
#

I need to figure out a way to extract text from a scan pdfs

slim remnant
#

what's wrong with the code? that looks correct

rugged meadow
#

It has not been able to extract the text from a scan pdf as I have to DM you the file

#

Sorry have to protect my PII

slim remnant
#

you don't have to send me anything

rugged meadow
#

Okay

#

hi is what I am talking about

slim remnant
#

the OCR might have a hard time reading the stylized text
is that what you're trying to capture?

rugged meadow
#

Yes

#

From like notes if I scan in a pdf and want to extract the text from there

#

It seems like it is easier for people to be able to do it

slim remnant
rugged meadow
#

Are you good at vs studio keyboard shortcuts as I cannot be able to type as it just wants to delte everything

slim remnant
#

nah I don't use it

rugged meadow
#

Okay as thank you

rugged meadow
#

!close

hidden bridgeBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.