gmanny / Pechkin

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

No images in PDF when using SynchronizedPechkin? #35

Open aloksharma1 opened 11 years ago

aloksharma1 commented 11 years ago

hello, first of all many thanks for creating such a wonderful library, it is a blessing to have it around. Now, as you can see in my question, my SynchronizedPechkin class is generating a nice pdf but without images of html page. I am also afraid to ask this question as i am new to this library and i hope i am not offending anyone here. So here is my code:

byte[] pdfBuf = new SynchronizedPechkin(new GlobalConfig()).Convert(new ObjectConfig().SetCreateExternalLinks(true).SetFallbackEncoding(Encoding.ASCII).SetLoadImages(true).SetAllowLocalContent(true).SetPageUri("http://google.com")); File.WriteAllBytes(Server.MapPath("~/testpdf/pechkin.pdf"), pdfBuf);

but the images from page are missing. Also i want to ask if i generate charts on html and then pass it on to pechkin will it be included, i hope i am not missing anything in this code. Thanks & Regards Alok Sharma

Zarium commented 11 years ago

check if wkhtmltopdf can process your page properly. I also thought it Pechkin's bug, but apparently wkhtmltopdf currently can't work with GIFs : https://code.google.com/p/wkhtmltopdf/issues/detail?id=441

anuragaj commented 9 years ago

Set the following for ObjectConfig object : ObjectConfig oc = new ObjectConfig();

oc.SetPrintBackground(true).SetScreenMediaType(true);

It worked for me.