1 parent 98d64ca commit 91bd772Copy full SHA for 91bd772
AUTOMATION/pdfToText.py
@@ -1,10 +1,15 @@
1
+import argparse
2
import pdfminer.high_level
3
-# Extract with Pdfminer.six Module
4
-def With_PdfMiner():
5
-with open('test.pdf','rb') as fh:
6
-doc = pdfminer.high_level.extract_text(fh)
+# Extract text with Pdfminer.six Module
+def With_PdfMiner(pdf):
+with open(pdf,'rb') as file_handle:
7
+doc = pdfminer.high_level.extract_text(file_handle)
8
print(doc)
9
10
if __name__ == '__main__':
-With_PdfMiner()
11
+parser = argparse.ArgumentParser()
12
+parser.add_argument("file", help = "PDF file from which we extract text")
13
+args = parser.parse_args()
14
+# print()
15
+With_PdfMiner(args.file)
AUTOMATION/test.pdf
7.76 KB
0 commit comments