I am converting a HTML string to PDF by using iTextSharp XMLWorker. previuosly this was working fine and generates nice pdf files but later I added base64 string Images to My HTML string which I want to show in my PDF. it is working fine for few images( small string ) but when number of images increases parallelly the size of the string increases. I am returning HTML string from a function like this
sb = new StringBuilder();
tw = new StringWriter(sb);
hw = new HtmlTextWriter(tw);
tblDistrictwiseResults.RenderControl(hw);
return sb.ToString();
and now returned HTML string is appending to another string like below
StringBuilder sb = new StringBuilder();
sbFooter = new StringBuilder();
tw = new StringWriter(sbFooter);
hw = new HtmlTextWriter(tw);
tblFooter.RenderControl(hw);
string pdfString = GetPDFString(paperCode, paperName, true); //This is the string returned from anothe function
sb.Append(pdfString + "<br />" + sbFooter.ToString()); //concatinating returned string and footer string and saving in another stringbuilder( here I am gettiong OOM Exception )
and the string becomes very large but it did not exceed maxcapacity of the StringBuilder.
Please someone help me
EDIT: I am using VS2010(32 bit) and DEV Server 32 bit
" + sbFooter.ToString());` . Read @SomeGuy comment. – May 30 '20 at 02:01