25 lines
830 B
Python
25 lines
830 B
Python
import argparse
|
|
import os
|
|
|
|
import contabilidad.pdf as pdf
|
|
import contabilidad.text_handler as th
|
|
|
|
|
|
def main(args):
|
|
filename = os.path.realpath(os.path.join(os.path.dirname(__file__), '..', 'data', args.filename))
|
|
temp = os.path.realpath(os.path.join(os.path.dirname(__file__), '..', 'data', args.temp_filename))
|
|
pdf.remove_encryption(filename, args.password, temp)
|
|
obj = pdf.get_data(temp)
|
|
obj = pdf.get_text(filename, args.password)
|
|
text = th.text_cleanup(obj, filename=str(args.filename))
|
|
os.remove(temp)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument('-f', '--filename', type=str)
|
|
parser.add_argument('-p', '--password', type=str, default='')
|
|
parser.add_argument('-t', '--temp_filename', type=str)
|
|
_args = parser.parse_args()
|
|
main(_args)
|