how to convert html file into pdf file.
can any help me to get this plzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Aug 29, 2013, 11:08 PM EDT
refer to this link
http://aspsnippets.com/Articles/Export-HTML-DIV-contents-to-PDF-using-iTextSharp-in-ASPNet.aspx
Satyapriya NayakRank #47 · 31.5K reputationPosted Aug 29, 2013, 11:18 PM EDT
Rosi Sreenivasa Reddy137 reputationPosted Aug 29, 2013, 11:43 PM EDT
so i am looking how to convert my aspx page...to pdf by URL......which contains gridview and inline styles applied on the page could you plz help ...?
for ex:
i have 2 page default.aspx
invoice.aspx
when i click button in default.aspx to generate pdf....by passing the url of invoice.aspx
just like passing
generateinvoice("localhost:1234//invoice.aspx");
i should get my invoice.aspx page tp invoice.pdf with the styles applied..on the pdf page ..
how to achieve this using any opensource dll.....could you plz elaborate.... as am new beee here...so that i can understnd
Rosi Sreenivasa Reddy137 reputationPosted Aug 30, 2013, 1:06 AM EDT
so i am looking how to convert my aspx page...to pdf by URL......which contains gridview and inline styles applied on the page could you plz help ...?
for ex:
i have 2 page default.aspx
invoice.aspx
when i click button in default.aspx to generate pdf....by passing the url of invoice.aspx
just like passing
generateinvoice("localhost:1234//invoice.aspx");
i should get my invoice.aspx page tp invoice.pdf with the styles applied..on the pdf page ..
how to achieve this using any opensource dll.....could you plz elaborate.... as am new beee here...so that i can understnd
plzzzzzzzzz can any one see this problem and send some answer i got strucked urgent..................................
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Aug 30, 2013, 1:35 AM EDT
you can follow this link:
for this you need thirdparty dll
http://www.aspsnippets.com/Articles/Export-ASPNet-Web-Page-with-images-to-PDF-using-ITextsharp.aspx
Rosi Sreenivasa Reddy137 reputationPosted Aug 31, 2013, 1:47 AM EDT
Ring ZhongRank #6,843 · 255 reputationPosted Sep 10, 2013, 7:23 PM EDT
using Spire.Pdf;
namespace htmltopdf
{
class Program
{
[STAThread]
static void Main(string[] args)
{
//Create a pdf document.
PdfDocument doc = new PdfDocument();
String url = "http://www.london2012.com/news/articles/paralympic-torch-relay-route-revealed-1258473.html";
doc.LoadFromHTML(url, false, true, true);
//Save pdf file.
doc.SaveToFile("sample.pdf");
doc.Close();
//Launching the Pdf file.
System.Diagnostics.Process.Start("sample.pdf");
}
}
}
you should use the third-party dll to finish converting html to pdf file in high quality.
rebecca yang18 reputationPosted Sep 13, 2013, 12:14 AM EDT
Steve Handerson2 reputationPosted Feb 12, 2014, 11:13 PM EST
Nicholas Barns12 reputationPosted May 2, 2014, 12:57 AM EDT
protected void Button1_Click(object sender, EventArgs e) { StringWriter sw = new StringWriter(); HttpContext.Current.Server.Execute("~/invoice.aspx", sw); DocumentModel document; var option = new HtmlLoadOptions() { BaseAddress = this.Request.PhysicalApplicationPath }; using (var htmlStream = new MemoryStream(option.Encoding.GetBytes(sw.ToString()))) document = DocumentModel.Load(htmlStream, option); document.Save(this.Response, "Invoice.pdf"); }Also in case I misunderstood you and you are actually looking to create a PDF while inside a invoice.aspx then just replace the code for retrieving a HTML formatted string with a following:
protected void Button1_Click(object sender, EventArgs e) { StringWriter sw = new StringWriter(); HtmlTextWriter hw = new HtmlTextWriter(sw); this.Page.RenderControl(hw); // ...Munesh SharmaRank #174 · 13.9K reputationPosted May 2, 2014, 1:21 AM EDT
http://www.c-sharpcorner.com/UploadFile/9f0ae2/convert-aspx-page-into-pdf-in-Asp-Net/
Hudson Lane7 reputationPosted Jun 15, 2014, 10:24 PM EDT
http://www.aspose.com/docs/display/pdfnet/HTML%20to%20PDF%20conversion