-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconverter.py
65 lines (54 loc) · 1.85 KB
/
converter.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# -*- coding: utf-8 -*-
import pdf2docx
from action import Action
from office import Office
class Converter:
@staticmethod
def convert(src_file, dst_file, action):
if action == Action.Pdf2Word:
Converter.do_pdf2word(src_file, dst_file)
elif action == Action.Pdf2Excel:
Converter.do_pdf2excel(src_file, dst_file)
elif action == Action.Pdf2PPT:
Converter.do_pdf2ppt(src_file, dst_file)
elif action == Action.Pdf2Image:
Converter.do_pdf2image(src_file, dst_file)
elif action == Action.Word2Pdf:
Converter.do_word2pdf(src_file, dst_file)
elif action == Action.Excel2Pdf:
Converter.do_excel2pdf(src_file, dst_file)
elif action == Action.PPT2Pdf:
Converter.do_ppt2pdf(src_file, dst_file)
elif action == Action.PDFSplit:
Converter.do_pdfsplit(src_file, dst_file)
elif action == Action.PDFMerge:
Converter.do_pdfmerge(src_file, dst_file)
@staticmethod
def do_pdf2word(src_file, dst_file):
converter = pdf2docx.Converter(pdf_file = src_file)
converter.convert(docx_filename=dst_file)
converter.close()
@staticmethod
def do_pdf2excel(src_file, dst_file):
pass
@staticmethod
def do_pdf2ppt(src_file, dst_file):
pass
@staticmethod
def do_pdf2image(src_file, dst_file):
pass
@staticmethod
def do_word2pdf(src_file, dst_file):
Office.word2pdf(src_file, dst_file)
@staticmethod
def do_excel2pdf(src_file, dst_file):
Office.excel2pdf(src_file, dst_file)
@staticmethod
def do_ppt2pdf(src_file, dst_file):
Office.ppt2pdf(src_file, dst_file)
@staticmethod
def do_pdfsplit(src_file, dst_file):
pass
@staticmethod
def do_pdfmerge(src_file, dst_file):
pass