Click here to Skip to main content
16,019,614 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to export div content to pdf in landscape mode in c#f on button click.

i have code like this...


Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment;filename=Payout_" + Label3.Text.Trim() + "to" + Label4.Text.Trim() + ".pdf");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
StringWriter stringWriter = new StringWriter();
HtmlTextWriter htmlTextWriter = new HtmlTextWriter(stringWriter);
AccessCard.RenderControl(htmlTextWriter);

StringReader stringReader = new StringReader(stringWriter.ToString());
Document Doc = new Document(PageSize.A4, 5f, 5f, 5f, 5f);
//Document Doc = new Document(new RectangleReadOnly(761, 498), 10f, 10f, 10f, 10f);
HTMLWorker htmlparser = new HTMLWorker(Doc);
PdfWriter.GetInstance(Doc, Response.OutputStream);
Doc.Open();
htmlparser.Parse(stringReader);

Doc.Close();
Response.Write(Doc);
Response.End();


please help me

thanks..
Posted
Updated 11-Jan-15 18:14pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900