Ok, first of all download the latest version of the HTMLDoc Software from this link. now extract the files and install the software on your Computer. it will ask "libeay32.dll file is missing. add this file from the folder you have in solution explorer. Now go to the folder which is being created by it after installation. copy all the files and folders and pasted it the folder you have in your project.
Now change your code as below:
if (!System.IO.Directory.Exists(Request.PhysicalApplicationPath + "pdf"))
{
System.IO.Directory.CreateDirectory(Request.PhysicalApplicationPath + "pdf");
}
string response;
url = "http://google.com";
pdfFile = Request.PhysicalApplicationPath + "pdf\\" + speechNumber + ".pdf";
//pdfFile = @"D:\\test.pdf";
exeFile = Request.PhysicalApplicationPath + "html2pdf\\htmldoc.exe";
GeneratePDF gPDF = new GeneratePDF();
response = gPDF.ShowPDF(url, pdfFile, exeFile);
gPDF = null;
if (response == "1")
{
email.sendMailWithAttachments(txtRecEmail.Text, "", "", txtSenEmail.Text, txtSenName.Text, txtSubject.Text, txtMessage.Text, Request.PhysicalApplicationPath + "pdf\\" + speechNumber + ".pdf", "speech.pdf");
Response.Redirect("EmailThanks.aspx?Email=" + txtRecEmail.Text);
}
else
{
throw new Exception(response);
}
That's All. Hope it will help you