mirror of
https://github.com/metafy-social/python-scripts.git
synced 2024-11-27 22:11:10 +00:00
Merge pull request #75 from anjali1102/master
[feat]: extract_text_from_pdf
This commit is contained in:
commit
7fd5a2b156
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