I'm trying to output a pdf
from an html
page using a python
script with weasyprint
library. I got the output as a pdf
file, but the pdf
page is not styled however I'm using bootstrap css style. This is a snippet of my code:
HTML('./result.html').write_pdf('./result.pdf', stylesheets=[CSS(filename='./bootstrap.css')])
result.html file:
<html>
<head>
<link rel="stylesheet" href="bootstrap.css">
</head>
<body>
<h1 class='text-primary'>Title</h1>
</body>
</html>
WeasyPrint version: 0.40
Assuming your routes are correct, you have to remove the 'filename=' in the CSS like: