getting closer, added a FIXME to one of the fields. Having issues with columns in description fields
This commit is contained in:
parent
5dde3be536
commit
40fcbdc8b8
3 changed files with 36 additions and 7 deletions
|
@ -4,6 +4,7 @@ from pyaccuwage.pdfextract import PDFRecordFinder
|
|||
import argparse
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
|
||||
parser = argparse.ArgumentParser(description="Parse and convert contents of IRS files into pyaccuwage e-file classes.")
|
||||
parser.add_argument("-i", "--input", nargs=1, required=True, metavar="file", type=argparse.FileType('r'), help="Source PDF file, ie: p1220.pdf")
|
||||
|
@ -30,8 +31,12 @@ source_file = os.path.abspath(args.input[0].name)
|
|||
doc = PDFRecordFinder(source_file)
|
||||
records = doc.records()
|
||||
builder = RecordBuilder()
|
||||
|
||||
for rec in records:
|
||||
print 'name', rec[0]
|
||||
for field in builder.load(map(lambda x:x.tuple, rec[1][1:])):
|
||||
print field
|
||||
|
||||
sys.stdout.write("class %s(object):\n" % re.sub('[^\w]','',rec[0]))
|
||||
|
||||
for field in builder.load(map(lambda x:x.tuple, rec[1][1:])):
|
||||
sys.stdout.write('\t' + field + '\n')
|
||||
#print field
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue