im trying to convert my web page to pdf, i saw this code:
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment;filename=TestPage.pdf");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
this.Page.RenderControl(hw);
StringReader sr = new StringReader(sw.ToString());
Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 100f, 0f);
HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
pdfDoc.Open();
htmlparser.Parse(sr);
pdfDoc.Close();
Response.Write(pdfDoc);
Response.End();
im not realy sure what every line here does but i used it on a new site and it worked, when im trying to use it on my project i get error, this is the line which gives the error: htmlparser.Parse(sr);
this is the error: could not find a part of the path 'C:\Program Files\Common Files\Microsoft Shared\DevServer\10.0\pic\1.jpg'
i the pic\1.jpg is in my project so i added it to that path (i dont know if thats what i need to do) but then it gave me another error: Font size too small: 0
am i approaching the problem right? what do i need to do to fix it?