Skip to content

Commit eb88435

Browse files
committed
Added certificate + render to pdf
1 parent 6bce9b6 commit eb88435

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed

ReplaceInDocument.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import subprocess
2+
3+
def replaceInDocument(FIO: str, dateTill: str, pdfFileName: str) -> None:
4+
with open("certificate.svg", "r", encoding="utf-8") as file:
5+
svg_content = file.read()
6+
svg_content = svg_content.replace("fioHandler", FIO)
7+
svg_content = svg_content.replace("dateHandler", dateTill)
8+
9+
temp_svg_path = "temp_certificate.svg"
10+
with open(temp_svg_path, "w", encoding="utf-8") as f:
11+
f.write(svg_content)
12+
subprocess.run([
13+
"inkscape",
14+
temp_svg_path,
15+
"--export-type=pdf",
16+
f"--export-filename={pdfFileName}"
17+
], check=True)
18+
19+
print(f"PDF успешно создан: {pdfFileName}")
20+

certificate.svg

Lines changed: 46 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)