Fix column parameter

pull/2/head
Vinayak Mehta 2016-10-13 16:54:45 +05:30
parent 40d30c1ab9
commit adb948d363
2 changed files with 3 additions and 1 deletions

View File

@ -376,6 +376,8 @@ class Stream:
cols = [rotate(0, 0, 0, c, -np.pi / 2)[0] for c in cols] cols = [rotate(0, 0, 0, c, -np.pi / 2)[0] for c in cols]
elif table_rotation == 'right': elif table_rotation == 'right':
cols = [rotate(0, 0, 0, c, np.pi / 2)[0] for c in cols] cols = [rotate(0, 0, 0, c, np.pi / 2)[0] for c in cols]
cols.insert(0, text_x_min)
cols.append(text_x_max)
cols = [(cols[i], cols[i + 1]) for i in range(0, len(cols) - 1)] cols = [(cols[i], cols[i + 1]) for i in range(0, len(cols) - 1)]
else: else:
if self.ncolumns is not None and self.ncolumns[table_no] != -1: if self.ncolumns is not None and self.ncolumns[table_no] != -1:

View File

@ -160,7 +160,7 @@ def test_stream_columns():
["01","Aguascalientes","001","Aguascalientes","0226","Hacienda Nueva"], ["01","Aguascalientes","001","Aguascalientes","0226","Hacienda Nueva"],
] ]
pdfname = os.path.join(testdir, "mexican_towns.pdf") pdfname = os.path.join(testdir, "mexican_towns.pdf")
manager = Pdf(Stream(columns=["28,67,180,230,425,475,700"], ytol=[10]), pdfname, manager = Pdf(Stream(columns=["67,180,230,425,475"], ytol=[10]), pdfname,
clean=True) clean=True)
tables = manager.extract() tables = manager.extract()
assert_equal(tables["page-1"]["table-1"]["data"], data) assert_equal(tables["page-1"]["table-1"]["data"], data)