I know this tool looks up on a url and converts the repsponse to pdf. How do I convert a
content..
into a pdf?
if you want to print specific part of html with Css
install Nuget packages:
Pechkin.Synchronized
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
pnlprint.RenderControl(hw);
StringReader sr = new StringReader(sw.ToString());
string cssPath = Server.MapPath("~/css/style1.css");
string cssString = File.ReadAllText(cssPath);
cssPath = Server.MapPath("~/css/bootstrap.css");
string cssString2 = File.ReadAllText(cssPath);
cssString += cssString2;
GlobalConfig gc = new GlobalConfig();
byte[] pdfContent = new SimplePechkin(new GlobalConfig()).Convert(@"" + sw.ToString() + "");
here you can easily understand the working of wkhtmltopdf https://ourcodeworld.com/articles/read/366/how-to-generate-a-pdf-from-html-using-wkhtmltopdf-with-c-in-winforms