tutorcruncher / pydf

PDF generation in python using wkhtmltopdf for heroku and docker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why it doesn't load images in PDF?

mojixcoder opened this issue · comments

In the rendered PDF images are not loaded.

here is main.py

import pydf


html_str = """
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width,initial-scale=1" />
    <title>بن اعتباری</title>
  </head>
  <body>
      <img src="./pizza.jpg" />
  </body>
</html>
"""



pdf = pydf.generate_pdf(html_str)
with open("test_doc.pdf", "wb") as f:
    f.write(pdf)

and image exists in that directory and everything is fine in html file

@mojixcoder I think this will probably answer your question! wkhtmltopdf/wkhtmltopdf#4723