Spaces:
Running
Running
whispersound
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -518,16 +518,18 @@ def save_to_pdf(blog_post, user_topic):
|
|
518 |
@font-face {{
|
519 |
font-family: 'NanumGothic';
|
520 |
src: url('{font_path}');
|
|
|
|
|
521 |
}}
|
522 |
body, h1, h2, h3, p, li {{
|
523 |
-
font-family: 'NanumGothic';
|
524 |
line-height: 1.6;
|
525 |
color: #333;
|
526 |
}}
|
527 |
""")
|
528 |
|
529 |
-
# WeasyPrint
|
530 |
-
HTML(string=blog_post).write_pdf(filename, stylesheets=[css])
|
531 |
|
532 |
print(f"Saving PDF as: {filename}")
|
533 |
return filename
|
|
|
518 |
@font-face {{
|
519 |
font-family: 'NanumGothic';
|
520 |
src: url('{font_path}');
|
521 |
+
font-weight: normal;
|
522 |
+
font-style: normal;
|
523 |
}}
|
524 |
body, h1, h2, h3, p, li {{
|
525 |
+
font-family: 'NanumGothic', sans-serif;
|
526 |
line-height: 1.6;
|
527 |
color: #333;
|
528 |
}}
|
529 |
""")
|
530 |
|
531 |
+
# HTML 인코딩 설정 및 WeasyPrint 사용하여 PDF로 변환 및 저장
|
532 |
+
HTML(string=blog_post.encode('utf-8').decode('utf-8')).write_pdf(filename, stylesheets=[css])
|
533 |
|
534 |
print(f"Saving PDF as: {filename}")
|
535 |
return filename
|