Bharat Jain
Bharat Jain

Reputation: 29

Image is not displayed in PDF

I am using wkhtmltopdf convert to convert HTML to PDF.

My image tag contain src from PHP file because we generate a graph and display it on the page.

My image tag looks like this:

img src="/PresentationLayer/GetChart.php?&type=PNG&img=bop1&id=mem1i21niqlsrha063vrbmk7t551f60c2597832"

Image are displayed in HTML but is not in PDF. Please provide some suggestion for that.

Upvotes: 0

Views: 3415

Answers (2)

Danny Beckett
Danny Beckett

Reputation: 20748

I came across the exact same issue with <img>s not displaying. My [rather hacky] solution was:

div.logo
{
    background-repeat: no-repeat;
    background-size: cover;
    width: 171px;
}

<div class="logo" style="background-image: url('path/to/img.png')">&nbsp;</div>

Upvotes: 0

Andrew Liu
Andrew Liu

Reputation: 2548

Suggestion: put a absolute image url in the src to see if it is your pdf generator problem or something else

Upvotes: 2

Related Questions