forked from ider-zh/api-pdf2htmlex
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
35 lines (30 loc) · 1.11 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
'''
@Version: 0.0.1
@Author: ider
@Date: 2019-08-10 16:39:32
@LastEditors: ider
@LastEditTime: 2019-08-10 18:17:23
@Description:
'''
import requests
# files = {'file': open('/home/ider/Downloads/252b71e4b944f67ee49225f7aee9dd8dfca860fb.PDF', 'rb')}
# data= {'command':'--command'}
# req = requests.post('http://localhost:5000?dd=11',files=files,data=data)
# print(req.text)
import subprocess
cmd = ["./pdf2htmlEX", "--embed-outline", "0",
"--embed-css", "1",
"--embed-font", "0",
"--embed-external-font", "0",
"--embed-image", "1",
"--embed-javascript", "0",
# "--external-hint-tool", "ttfautohint",
"--no-drm", "1",
"--dest-dir", '/tmp/cc',
# '/home/ider/workspace/jupyter/temp.pdf'
'/home/ider/Downloads/大国空巢 作者:易富贤.pdf'
]
try:
subprocess.check_output(cmd,stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
raise e