add script for convert pdf to text (#183)

Co-authored-by: pham.huu.quang <SUN-ASTERISK\pham.huu.quang@b121686-lt.sun-asterisk.com>
This commit is contained in:
QuangPH 2020-10-09 18:39:01 +07:00 committed by GitHub
parent 80bfc6c98d
commit d7b46ecaac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 1 deletions

11
PDF2text/README.md Normal file
View File

@ -0,0 +1,11 @@
# Description: PDF2text
this is a small script to make a extract text from pdf file.
### Dependencies:
1- [pdftotext](https://pypi.org/project/pdftotext/)
## Usage
Run ```python script.py``` then enter path of pdf file.

View File

@ -0,0 +1 @@
pdftotext

15
PDF2text/script.py Normal file
View File

@ -0,0 +1,15 @@
import os
import pdftotext
pdf_path = input("Enter the path of the pdf file : ")
assert os.path.exists(pdf_path), "this pdf file doesn't exist"
with open(pdf_path, 'rb') as f_r:
pdf_pages = pdftotext.PDF(f_r)
for i, page in enumerate(pdf_pages):
print('Page {}'.format(i))
print(page)
print('*'*100)

View File

@ -156,10 +156,10 @@ So far, the following projects have been integrated to this repo:
|[Codeforces Checker](codeforcesChecker)|[Jinesh Parakh](https://github.com/jineshparakh)| |[Codeforces Checker](codeforcesChecker)|[Jinesh Parakh](https://github.com/jineshparakh)|
|[Github repo creator](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Git_repo_creator)|[Harish Tiwari ](https://github.com/optimist2309) |[Github repo creator](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Git_repo_creator)|[Harish Tiwari ](https://github.com/optimist2309)
|[Remove-Duplicate-Files](Remove-Duplicate-Files)|[Aayushi Varma](https://github.com/aayuv17) |[Remove-Duplicate-Files](Remove-Duplicate-Files)|[Aayushi Varma](https://github.com/aayuv17)
|[PDF2text](PDF2text)|[QuangPH](https://github.com/quangph-1686a)
|[Image Watermarker (batch)](Image Watermarker (batch))|[Remco Halman](https://github.com/remcohalman) |[Image Watermarker (batch)](Image Watermarker (batch))|[Remco Halman](https://github.com/remcohalman)
## How to use : ## How to use :
- Clone/Download the directory and navigate to each folder. Or... - Clone/Download the directory and navigate to each folder. Or...