-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig_exportPdfFromHtml_template.py
More file actions
70 lines (52 loc) · 1.87 KB
/
config_exportPdfFromHtml_template.py
File metadata and controls
70 lines (52 loc) · 1.87 KB
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
66
67
68
69
70
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Sets up the local environment of the user for the script exportPdfFromHtml.py
Sets up the local environment of the user for the script exportPdfFromHtml.py
As it is a template, please copy it first to a file named
"config_exportPdfFromHtml.py"!
After copy, it is strongly recommended to setup all necessary parameters in
the init() function, before running the script exportPdfFromHtml.py
for the first time.
"""
import os
# ---------------------------
def init() -> dict:
"""
setup all necessary parameters for this script to work.
Parameter
---------
none
Rerturns
--------
dictionary
all global program parameters are stored there
"""
print("DEBUG: init()")
parameters = {}
# evaluate the absolut path to this script file and set it as
# project root dir
# DO NOT CHANGE!
aPath = os.path.realpath(__file__)
aPath = os.path.dirname(aPath)
aPath = os.path.normpath(aPath)
# all the HTML files with the file extensions ".html"
# will get read for export into the PDF format
# DO NOT CHANGE!
parameters['html_input_path'] = os.path.join(aPath, "_www")
# DO NOT CHANGE!
parameters['pdf_output_path'] = os.path.join(aPath, "_pdf")
# absolut path to the current Users windows home path
# DO NOT CHANGE!
parameters['user_home_path'] = os.path.join(
os.environ['HOMEDRIVE'], os.sep, os.environ['HOMEPATH'])
# absolut path to the root folder of all application installations
# DO NOT CHANGE!
apps_installation_root = os.path.join(
parameters['user_home_path'], "installations")
# CHANGE THIS!
# absolut path to the draw.io app
parameters['wkhtmltopdf_app_path'] = os.path.join(apps_installation_root,
"wkhtmltox",
"bin",
"wkhtmltopdf.exe")
return parameters