Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
poc
pdftra
Commits
4294724c
Commit
4294724c
authored
Feb 25, 2020
by
Pratap Vardhan
Browse files
FIX: lint errors
parent
b208ba82
Pipeline
#114232
passed with stages
in 41 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
js/app.js
View file @
4294724c
...
...
@@ -18,7 +18,7 @@ const apis = {
pdftojson
:
function
(
opts
)
{
return
$
.
getJSON
(
'
./pdftojson
'
,
{
filename
:
opts
.
filename
})
.
done
(
data
=>
$
(
window
).
trigger
(
'
data-table
'
,
data
))
.
fail
(()
=>
console
.
log
(
'
ERROR: pdftojson
'
))
.
fail
(()
=>
console
.
log
(
'
ERROR: pdftojson
'
))
// eslint-disable-line no-console
}
}
// setup elements
...
...
pdftra.py
View file @
4294724c
...
...
@@ -2,6 +2,7 @@ from io import StringIO
import
logging
import
pandas
as
pd
import
camelot
from
gramex.http
import
BAD_REQUEST
logging
.
getLogger
(
'pdfminer'
).
setLevel
(
logging
.
ERROR
)
...
...
@@ -23,7 +24,7 @@ def extract_table(path):
def
pdftojson
(
handler
):
filename
=
handler
.
args
.
get
(
'filename'
,
[
False
])[
0
]
if
not
filename
:
return
handler
.
set_status
(
400
)
return
handler
.
set_status
(
BAD_REQUEST
)
result
=
extract_table
(
handler
.
kwargs
.
path
+
filename
)
return
{
'data'
:
result
[
'df'
].
to_dict
(
orient
=
'r'
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment