How to render external files?
malikovss opened this issue · comments
How to render external files: css, images, fonts??
ar_template = """
<html>
<head>
<title>arabic</title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<style type="text/css">
@font-face {{
font-family: "Font";
src: url("font.ttf") format("truetype");
}}
#ar{{
font-family:Font;
font-size: 36px;
margin: 30px;
border: 1px solid black;
}}
</style>
</head>
<body>
<p id="ar" dir="rtl" lang="ar">{content}</p>
</body>
</html>
"""
I wrote external font link. it didnot work
Hi @malikovss hope you worked this out.
For anyone else coming to this issue:
The solution is to make make the assets available online somewhere, can even be localhost so wkhtmltopdf can request the files over the network.
For small images etc., you might be able to use a data uri.