Code: Select all
import pandas as pd
import requests
from jinja2 import Environment, FileSystemLoader
from weasyprint import HTML
# Stuff to get dataframe...
# Generate PDF and csv
env = Environment(loader=FileSystemLoader('.'))
template = env.get_template("template.html")
template_vars = {"title" : "Something...",
"vulnerabilities_table": df.to_html(index=False)}
html_out = template.render(template_vars)
HTML(string=html_out).write_pdf("report_styled.pdf", stylesheets=["style.css"])
Code: Select all
{% block layout_style %}
@page { size: letter landscape; margin: 2cm; }
{% endblock %}
{{ title }}
[img]static/images/Logo.png[/img]
{{ title }}
{{ vulnerabilities_table }}
< /code>
Das [url=viewtopic.php?t=20324]Problem[/url] ist, dass das Bild überhaupt nicht rendert (aber der Rest tut es). Ich denke, es liegt daran
[img]static/images/Logo.png[/img]