gmanny / Pechkin

.NET Wrapper for WkHtmlToPdf static DLL. Allows you to utilize full power of the library.
401 stars 128 forks source link

Unable to render images while converting. #83

Open muralinit opened 9 years ago

muralinit commented 9 years ago

Hi gmanny,

Thanks for the wonderful wrapper. I am using the below code to convert my html content to pdf.

var pdfOutputStream = new SynchronizedPechkin(new GlobalConfig().SetImageQuality(imageQuality). SetMaxImageDpi(dpi)).Convert(new ObjectConfig().SetLoadImages(true) .SetPrintBackground(true) .SetScreenMediaType(true) .SetCreateExternalLinks(true) .SetAllowLocalContent(true) .SetIntelligentShrinking(true) .SetMinFontSize(12)

                                                                                      ,
                                                                                  HttpUtility.HtmlDecode(outlookMessageHtml));

Please find the html file in the below location just for your reference where it contains my html text. https://www.dropbox.com/s/7as2s51n78f6eda/new3.html?dl=0

Below is the output of the pdf file. https://www.dropbox.com/s/vvaesh70l864qce/tmpcc74.pdf?dl=0

It is missing the images rendered. Can you please clarify me am I doing anything wrong.

Thanks & Regards, N.Murali Krishna.

CSADn commented 9 years ago

I got the same problem, but I figured out that if you put an absolute URI to the image resource, it works! I mean, instead of src=data... or src=../img/some.png, this src=www.mydomain.com/images/some.png