// Instantiate an object PDF class
Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();
// add the section to PDF document sections collection
Aspose.Pdf.Generator.Section section = pdf.Sections.Add();
// Read the contents of HTML file into StreamReader object
StreamReader r = File.OpenText(@"D:/pdftest/HTML2pdf.html");
//Create text paragraphs containing HTML text
Aspose.Pdf.Generator.Text text2 = new Aspose.Pdf.Generator.Text(section, r.ReadToEnd());
// enable the property to display HTML contents within their own formatting
text2.IsHtmlTagSupported = true;
//Add the text paragraphs containing HTML text to the section
section.Paragraphs.Add(text2);
// Specify the URL which serves as images database
pdf.HtmlInfo.ImgUrl = "D:/pdftest/MemoryStream/";
//Save the pdf document
pdf.Save("D:/pdftest/MemoryStream/HTML2pdf.pdf");
I have tried this
html to pdf converter with complex pages. Convert fast and precisely anything a browser can render HTML / HTML5, CSS3, Canvas, SVG, JavaScript, jQuery, etc TO pdf, svg or image
tanveer_uos
Member
376 Points
213 Posts
how to create pdf file from webpage?
Feb 16, 2012 01:46 PM|LINK
Hi
I have a webpage i want to create pdf file from this.
webpage hase dropdownlist, textboxes, gridviews, and tables i want to create pdf file from these control
please give me some code same like this closely. or any link
please help me it is urgent
Tanveer Ahmad
Please do not forget to mark as answer if my post help you!
dinakaran
Member
625 Points
216 Posts
Re: how to create pdf file from webpage?
Feb 16, 2012 03:17 PM|LINK
Hi tanveer,
follow this links
http://www.4guysfromrolla.com/articles/030911-1.aspx#postadlink
http://www.dotnetspark.com/kb/654-simple-way-to-create-pdf-document-using.aspx
i hope it helps you
ramiramilu
All-Star
95315 Points
14072 Posts
Re: how to create pdf file from webpage?
Feb 16, 2012 03:26 PM|LINK
Work with ITextSharp - http://mikesdotnetting.com/Category/20
and for controls to get onto the pdf try this suggestion - http://forums.asp.net/t/1753705.aspx/1
Thanks,
JumpStart
marko4
Member
320 Points
78 Posts
Re: how to create pdf file from webpage?
Feb 16, 2012 05:34 PM|LINK
there is a great tool that can convert html pages with css to a pdf file, try it:
http://code.google.com/p/wkhtmltopdf/
Cheng Bao
Member
191 Points
125 Posts
Re: how to create pdf file from webpage?
Feb 16, 2012 05:38 PM|LINK
@marko4:
I, too, use this application, and it works great.
srinanthuram
Contributor
6800 Points
1549 Posts
Re: how to create pdf file from webpage?
Feb 16, 2012 05:54 PM|LINK
hi
pls see this url
http://www.csharpaspnetarticles.com/2008/12/export-gridview-to-pdf-using-itextsharp.html
http://www.aspdotnet-suresh.com/2011/04/how-to-export-gridview-data-to-pdf.html
thsnk u
pdfres
Member
6 Points
3 Posts
Re: how to create pdf file from webpage?
Feb 20, 2012 08:12 AM|LINK
This html to pdf library for .net is what you need. Evenmore, there is a sample for how to capture the values you filled in page in the final PDF.
shahzad.lati...
Member
82 Points
21 Posts
Re: how to create pdf file from webpage?
Feb 20, 2012 11:22 AM|LINK
You may try Aspose.Pdf for .NET to convert HTML to PDF.
Code is very simple:
// Instantiate an object PDF class Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf(); // add the section to PDF document sections collection Aspose.Pdf.Generator.Section section = pdf.Sections.Add(); // Read the contents of HTML file into StreamReader object StreamReader r = File.OpenText(@"D:/pdftest/HTML2pdf.html"); //Create text paragraphs containing HTML text Aspose.Pdf.Generator.Text text2 = new Aspose.Pdf.Generator.Text(section, r.ReadToEnd()); // enable the property to display HTML contents within their own formatting text2.IsHtmlTagSupported = true; //Add the text paragraphs containing HTML text to the section section.Paragraphs.Add(text2); // Specify the URL which serves as images database pdf.HtmlInfo.ImgUrl = "D:/pdftest/MemoryStream/"; //Save the pdf document pdf.Save("D:/pdftest/MemoryStream/HTML2pdf.pdf");mattdwit
Member
12 Points
10 Posts
Re: how to create pdf file from webpage?
Mar 04, 2012 08:17 PM|LINK
I have tried this html to pdf converter with complex pages. Convert fast and precisely anything a browser can render HTML / HTML5, CSS3, Canvas, SVG, JavaScript, jQuery, etc TO pdf, svg or image
pdf html Converter
tarunSaini
Contributor
2948 Points
985 Posts
Re: how to create pdf file from webpage?
Jun 15, 2012 05:13 PM|LINK
check this . i hope this is use full for you
http://www.aspsnippets.com/Articles/Export-GridView-To-Word-Excel-PDF-CSV-Formats-in-ASP.Net.aspx