-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadobe_script.py
More file actions
32 lines (23 loc) · 785 Bytes
/
Copy pathadobe_script.py
File metadata and controls
32 lines (23 loc) · 785 Bytes
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
import os
import winerror
from win32com.client.dynamic import Dispatch, ERRORS_BAD_CONTEXT
ERRORS_BAD_CONTEXT.append(winerror.E_NOTIMPL)
PDSaveLinearized = True
PDSaveFull = True
def pdf_to_html(filename):
src = os.path.abspath(filename)
try:
AvDoc = Dispatch("AcroExch.AVDoc")
if AvDoc.Open(src, ""):
pdDoc = AvDoc.GetPDDoc()
jsObject = pdDoc.GetJSObject()
jsObject.SaveAs("C:/Users/Administrator/Desktop/proj_para_split/htmls/" +filename+ ".html", "com.adobe.acrobat.html")
except Exception as e:
print(str(e))
return "nodata"
finally:
AvDoc.Close(True)
jsObject = None
pdDoc = None
AvDoc = None
return "htmls/" +filename+ ".html"