Kozea / WeasyPrint

The awesome document factory
https://weasyprint.org
BSD 3-Clause "New" or "Revised" License
7.23k stars 687 forks source link

pdf output not showing image #964

Closed imsuneaik closed 4 years ago

imsuneaik commented 5 years ago

Hi everyone, I was trying to create a html webpage. I have included on my html which can be seen on my localserver. However, upon printing as PDF. The image is missing.

Tontyna commented 5 years ago

Any WARNING in the console output?

imsuneaik commented 5 years ago

Console shows, GET /static/css/style.css HTTP/1.1" 304 but shortly after GET /static/css/style.css HTTP/1.1" 200

Webpage still able to display elements just without CSS.

Tontyna commented 5 years ago

No warning along the lines of Failed to load image at ...?

AFAIK GET /static/css/style.css HTTP/1.1" 304 isn't an output that WeasyPrint generates. How do you invoke WeasyPrint?

craigpla commented 5 years ago

python3 -m weasyprint "$filename.html" "$filename.pdf" is how I'm doing it. I wrote a big walkthrough for Linux Academy lately (with a link to a github repo with the template I used) if you're interested: https://linuxacademy.com/blog/tutorials/convert-markdown-to-pdf-tutorial/

Tontyna commented 5 years ago

I'd really like to see the "$filename.html" -- if there is an <img> tag inside and WeasyPrint finds the image the image will be in the PDF. If WeasyPrint cannot find the image it writes an error to the console.

liZe commented 5 years ago

@imsuneaik Could you please provide your HTML file? We can't solve this issue without your sample.

@craigpla Thanks a lot for this tutorial! :heart:

craigpla commented 5 years ago

Oops, I didn't see the message last month. Sorry folks. README.html is up in this repo: https://github.com/linuxacademy/techwriting-cp-posts

liZe commented 5 years ago

I've cloned the repository and launched weasyprint README.html README.pdf, the images are included in the PDF file and there's no error.

liZe commented 4 years ago

@craigpla @imsuneaik Can I do anything else for you, or maybe close this issue?

liZe commented 4 years ago

Please reopen if needed.