Add Stream benchmarks

This commit is contained in:
Vinayak Mehta committed 2018-09-12 07:21:35 +05:30
1 parent b276909a4f
commit 0ba3469d21
89 files changed
+848 -34

No files matched your search

+4
View File
@@ -81,6 +81,8 @@ class PDFHandler(object):
""" """
with open(filename, 'rb') as fileobj: with open(filename, 'rb') as fileobj:
infile = PdfFileReader(fileobj, strict=False) infile = PdfFileReader(fileobj, strict=False)
if infile.isEncrypted:
infile.decrypt('')
fpath = os.path.join(temp, 'page-{0}.pdf'.format(page)) fpath = os.path.join(temp, 'page-{0}.pdf'.format(page))
froot, fext = os.path.splitext(fpath) froot, fext = os.path.splitext(fpath)
p = infile.getPage(page - 1) p = infile.getPage(page - 1)
@@ -98,6 +100,8 @@ class PDFHandler(object):
fpath_new = ''.join([froot.replace('page', 'p'), '_rotated', fext]) fpath_new = ''.join([froot.replace('page', 'p'), '_rotated', fext])
os.rename(fpath, fpath_new) os.rename(fpath, fpath_new)
infile = PdfFileReader(open(fpath_new, 'rb'), strict=False) infile = PdfFileReader(open(fpath_new, 'rb'), strict=False)
if infile.isEncrypted:
infile.decrypt('')
outfile = PdfFileWriter() outfile = PdfFileWriter()
p = infile.getPage(0) p = infile.getPage(0)
if rotation == 'anticlockwise': if rotation == 'anticlockwise':
+1 -2
View File
@@ -294,8 +294,7 @@ class Stream(BaseParser):
if ncols == 1: if ncols == 1:
logger.info("No tables found on {}".format( logger.info("No tables found on {}".format(
os.path.basename(self.rootname))) os.path.basename(self.rootname)))
cols = [(t.x0, t.x1) cols = [(t.x0, t.x1) for r in rows_grouped if len(r) == ncols for t in r]
for r in rows_grouped if len(r) == ncols for t in r]
cols = self._merge_columns(sorted(cols), col_close_tol=self.col_close_tol) cols = self._merge_columns(sorted(cols), col_close_tol=self.col_close_tol)
inner_text = [] inner_text = []
for i in range(1, len(cols)): for i in range(1, len(cols)):
File renamed without changes.
Internal Server Error - Briq - repository git
500 Internal Server Error

An error occurred:

An error occurred

Gitea Version: 28.2.0