12345678910111213141516171819202122232425262728293031323334353637 |
- import tabula
- import camelot
- import subprocess
- import re
- #tables = tabula.read_pdf("iso_documents/ISO2768-1.PDF", pages=3)
- #for table in tables:
- # print(table)
- #pdftotext - layout!!!!
- #tabula.convert_into("iso_documents/ISO2768-1.PDF", "output_mit_tabula.csv", output_format="csv", pages='all', multiple_tables=True)
- #df = tabula.read_pdf("iso_documents/ISO1101.PDF", pages='all', multiple_tables=True)
- #print(df)
- def file_read(fname):
- content_array = []
- with open(fname) as f:
- # Content_list is the list that contains the read lines.
- for line in f:
- content_array.append(line.strip().replace(" ",""))
- print(content_array)
- #file_read('drawings/5129275_Rev01-GV12.txt')
- tables = camelot.read_pdf("iso_documents/ISO2768-1.PDF", pages="3")
- tables.export('output_mit_camelot.csv', f='csv')
- output = subprocess.check_output(["less","iso_documents/ISO2768-1.PDF"])
- re_data_prefix = re.compile("^[0-9]+[.].*$")
- re_data_fields = re.compile("(([^ ]+[ ]?)+)")
- for line in output.splitlines():
- if re_data_prefix.match(line):
- for l in re_data_fields.findall(line):
- print[l[0].strip()]
|