mirror of
https://github.com/metafy-social/python-scripts.git
synced 2024-11-23 20:11:10 +00:00
[feat]: extract_text_from_pdf
This commit is contained in:
parent
8618617f1e
commit
47f35b7358
9
scripts/extract_text_from_pdf/README.md
Normal file
9
scripts/extract_text_from_pdf/README.md
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
# extract text from pdf
|
||||||
|
|
||||||
|
This simple script will extract text from pdf
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
- requires PyPDF2
|
||||||
|
- Use `pip3 install PyPDF2`
|
||||||
|
- Run `python script.py`
|
7
scripts/extract_text_from_pdf/script.py
Normal file
7
scripts/extract_text_from_pdf/script.py
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
import PyPDF2
|
||||||
|
pdfFileObject = open('sample.pdf', 'rb')
|
||||||
|
pdfReader = PyPDF2.PdfFileReader(pdfFileObject)
|
||||||
|
count = pdfReader.numPages
|
||||||
|
for i in range(count):
|
||||||
|
page = pdfReader.getPage(i)
|
||||||
|
print(page.extractText())
|
Loading…
Reference in New Issue
Block a user