Click here to Skip to main content
15,895,423 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want convert html page to pdf Using asp.net by c#
Posted
Comments
raj ch 26-Aug-13 5:38am    
use third party tools like itextsharp,PdfSharp etc.

protected void Page_Load(object sender, EventArgs e)
{

ArrayList ary = new ArrayList();
ary.Add(Cache["testr"]);
Cache.Remove("testr");

BinaryFormatter f = new BinaryFormatter();
MemoryStream ms = new MemoryStream();
f.Serialize(ms, ary);

CR_visitor_Pass cr = new CR_visitor_Pass();
cr.Load(Server.MapPath("~/CR_visitor_Pass.rpt"));
//MemoryStream oStream; // using System.IO
//oStream = (MemoryStream) ary;
Response.Clear();
Response.Buffer = true;
Response.ContentType = "application/pdf";
Response.BinaryWrite(ms.ToArray());
Response.End();

}
 
Share this answer
 
Comments
Member 10296662 11-Feb-14 2:55am    
hi! Is there not any idea to convert a html page into pdf using c# or using any
c# library , classes ?
Arrinters1975 19-Aug-15 3:40am    
Unfortunately there is no build in class(es) in .NET that can enable you to do this, you'll need to use some external library. For example you can take a look at this .NET library for manipulating with Word files. Beside the Word files it can manipulate with quite a few other document formats, also here is a demonstration sample for converting a HTML page into a PDF by using C#.
 
Share this answer
 

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