1

I have added the wkhtmltoxsharp.dll and Common.Logging.dll to the lust of references. I am using the following code to convert a html file to a pdf file.

WkHtmlToPdfConverter converter = new WkHtmlToPdfConverter(); byte[] strHTML = converter.Convert("C:\\test.html"); File.WriteAllBytes("C:\\test.pdf", strHTML); converter.Dispose();

All it does is give me a pdf file with the content "C:\test.html".

Could someone please tell me what I am doing wrong? Any help is appreciated!

Regards, SS

user1512781
  • 73
  • 3
  • 8

1 Answers1

1

You pass the Convert function the actual html. You want something like this:

IHtmlToPdfConverter converter = new MultiplexingConverter();
var bytes = converter.Convert("<html><body><p>blah</p></body></html>");
System.IO.File.WriteAllBytes("C:\\test.pdf", bytes);
matt burns
  • 24,742
  • 13
  • 105
  • 107