Skip to content

Commit

Permalink
Merge pull request #9 from tokmac/bugfix/special-character-broken-in-pdf
Browse files Browse the repository at this point in the history
fix(app): when try to pass down special characters (Cyrillic letters, umlauts, etc.), for generation of PDF it comes out broken
  • Loading branch information
WadeBarnes committed Jan 10, 2022
2 parents 78304cb + b3253d1 commit 7026883
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ def home():
def generate():
name = request.args.get('filename', 'unnamed.pdf')
app.logger.info('POST /pdf?filename=%s' % name)
#print ( request.get_data() )
html = HTML(string=request.get_data())
#print ( request.get_data(as_text=True) )
html = HTML(string=request.get_data(as_text=True))
css, font_config = css_for_extra_fonts()
pdf = html.write_pdf(stylesheets=[css], font_config=font_config)
response = make_response(pdf)
Expand Down
4 changes: 4 additions & 0 deletions test.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,9 @@
</head>
<body>
<h1>Hello World</h1>
<h1>Hello Wêreld!</h1>
<h1>Здравей свят!</h1>
<h1>გამარჯობა მსოფლიო!</h1>
<h1>Përshendetje Botë!</h1>
</body>
</html>

0 comments on commit 7026883

Please sign in to comment.