forked from gstaxy/EpubToPdf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
42 lines (33 loc) · 878 Bytes
/
main.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
import sys
from manage import FileManager
from getpy import GetEngine
from pdfpy import PdfEngine
def process():
if sys.argv[1].endswith(".epub"):
print('--- Epub to PDF conversion started')
epub_file = sys.argv[1]
file = FileManager(epub_file)
file.epub_to_zip()
file.get_directory()
file.extract_zip()
engine = GetEngine(file.directory)
#engine.get_all()
#engine.get_html()
engine.get_pages()
engine.get_pdf()
#engine.get_css()
#engine.get_images()
#pdf = PdfEngine(engine.html_files, engine.css_files,
#engine.pdf_files, file.directory)
pdf = PdfEngine(engine.pages,
engine.pdf_files, file.directory)
pdf.convert()
pdf.combine()
pdf.del_pdf()
file.zip_to_epub()
file.del_directory()
print('--- Epub to PDF conversion successful')
else:
print("File is not an epub file")
if __name__ == "__main__":
process()