Hi This is my code :
StringBuilder sb = new StringBuilder();
sb.Append("");
sb.Append("
sb.Append("
sb.Append(" ");
sb.Append("");
sb.Append("");
");
sb.Append("
sb.Append(" ");
sb.Append("");
StringReader sr = new StringReader(sb.ToString());
document.Open();
htmlparser.Parse(sr);
document.NewPage();
}
document.Close();
}
bytes = ms.ToArray();
}
Response.Clear();
//string pdfName = "template";
Response.AddHeader("Content-Disposition", "attachment; filename=" + orderID + "_" + "template" + ".pdf");
Response.ContentType = "application/pdf";
Response.Buffer = true;
Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
Response.BinaryWrite(bytes);
Response.End();
Response.Close();
sb.Append("
sb.Append("
");
sb.Append("" + "
" + " ");
sb.Append("
sb.Append("");
sb.Append("
");sb.Append("
sb.Append("
(602) 519-0450
");sb.Append("");
sb.Append("
sb.Append("
");
sb.Append("
sb.Append("
sb.Append("
sb.Append("
sb.Append("
sb.Append("
sb.Append("
");sb.Append("
PROJECT Website development
");sb.Append("
CLIENT John Doe
");sb.Append("
ADDRESS 796 Silver Harbour, TX 79273, US
");sb.Append("
EMAIL [email protected]
");sb.Append("
DATE April 13, 2016
");sb.Append("
DUE DATE May 13, 2016
");sb.Append("
sb.Append("
sb.Append("
sb.Append("
| SERVICE | ");DESCRIPTION | ");PRICE | ");QTY | ");TOTAL | ");
|---|---|---|---|---|
| Design | ");Creating a recognizable design solution based on the company's existing visual identity | ");$400.00 | ");2 | ");$800.00 | ");
| SUBTOTAL | ");$800.00 | ");|||
| TAX 25% | ");$200.00 | ");|||
| GRAND TOTAL | ");$1,000.00 | ");|||
sb.Append("
");
sb.Append("
sb.Append("
sb.Append("
");sb.Append("
NOTICE:
");sb.Append("
A finance charge of 1.5% will be made on unpaid balances after 30 days.
");sb.Append("
sb.Append("
sb.Append("");
StringReader sr = new StringReader(sb.ToString());
document.Open();
htmlparser.Parse(sr);
document.NewPage();
}
document.Close();
}
bytes = ms.ToArray();
}
Response.Clear();
//string pdfName = "template";
Response.AddHeader("Content-Disposition", "attachment; filename=" + orderID + "_" + "template" + ".pdf");
Response.ContentType = "application/pdf";
Response.Buffer = true;
Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
Response.BinaryWrite(bytes);
Response.End();
Response.Close();
throwing error like :
I added base64 string to the img src in string builder. if i remove image it will works fine.
Please give me proper solution.
Thanks.

Nishant MittalPosted Apr 26, 2016, 11:10 PM
- a) First add a reference to the Delimon.Win32.IO.dll to your project (Browse to the Delimon.Win32.IO.dll file)
- b) In your Code File add "using Delimon.Win32.IO"
- c) Use normal File & Directory Objects as if you are working with System.IO
For more info read this