2
votes

I am using the WkHtmlToXSharp wrapper for wkhtmltopdf converter. Text in the supplied html is successfully displayed in the generated pdf. But images are not showing. Then I changed the relative image path to absolute one with:

But this is still not working.

My method is:

public static string ConvertToPdf(string htmlContent,string pdfName)
    {
        WkHtmlToPdfConverter w = new WkHtmlToPdfConverter();
        byte[] str= w.Convert(htmlContent);
        string pdfUrl = HttpContext.Current.Server.MapPath("~/utils/PDF/"+pdfName);
        File.WriteAllBytes(pdfUrl, str);
        w.Dispose();
        return pdfUrl;
    }

Is there anything insufficient in this code? Any way out please?

1

1 Answers

2
votes

There is a known issue (http://code.google.com/p/wkhtmltopdf/issues/detail?id=441) with including GIF images. If that's the format you're using, you can try jpeg or png.