Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Help with HTML to PDF conversion with VB.net

Hi

I need some help with converting a HTML document to PDF format . I have added a web browser control to my VB.net Application where I am generating the report in HTML format . I need to save that HTML format report to PDF file . I have got couple of third party software that does that .But my boss want me to create a button on the print preview and when user click on that button it will save the HTML format report as PDF file . I like to know how to add a button to the print previw and also how to save HTML format document as PDF file with code ( vb.net ) . The third party software does not work for my company as we will have to install that software in our client computer ( to save the HTML report as PDF file ) when we will delivar the project . Client does not like that . So please help me with the code to save the HTML report to PDF format or if there is any free component available .

Thanks
[929 byte] By [software_develo] at [2007-11-11 7:55:28]
# 1 Re: Help with HTML to PDF conversion with VB.net
If you are not going to do a third party software , you seriously need to know where you are treading with respect to PDF's , I would only say for now it is a whole project by itself, with all due respect tell ur boss he has to change the time lines of his project if he choses to make you do a HTML - PDF conversion tool,
A lot of vendors sell them as products so I hope you understand how big an assignment it would be
srinivas_s at 2007-11-11 21:48:17 >
# 2 Re: Help with HTML to PDF conversion with VB.net
Hi

Thanks for the reply .Do you know any free component that will convert the HTML report to PDF format . I have got couple of third party software that does that but the problem is I will have to load those software in the client computer in order for convert HTML to PDF . Client does not want any extra software installed on their computers . I wonder if there is any free component to convert HTML to PDF which I can use in my VB.NET application

Thanks
software_develo at 2007-11-11 21:49:23 >
# 3 Re: Help with HTML to PDF conversion with VB.net
I know about ABCpdf which is to be used on the webserver so i am guessing this is a nice solution ? search for ABCPDF on google it is not very expensive and does the job neatly, There is a new .Net version for this component also
srinivas_s at 2007-11-11 21:50:22 >
# 4 Re: Help with HTML to PDF conversion with VB.net
kindly reply me how to convert html to pdf in vb.net code

thanks

jak
jak at 2007-11-11 21:51:22 >
# 5 Re: Help with HTML to PDF conversion with VB.net
The best one for its price the HTML to PDF Converter Library for .NET 2.0 (http://www.dotnet-reporting.com) from http://www.dotnet-reporting.com or the HTML to PDF Converter (http://www.winnovative-software.com) from http://www.winnovative-software.com . You can convert a HTML string or a web page URL to PDF in only a few lines of code:

PdfConverter pdfConverter = new PdfConverter();
pdfConverter.LicenseKey = "P38cBx6AWW7b9c81TjEGxnrazP+J7rOjs+9omJ3TUycauK+cLWdrITM5T59hdW5r";
// set the converter options
pdfConverter.PdfDocumentOptions.PdfPageSize = PdfPageSize.A4;
pdfConverter.PdfDocumentOptions.PdfCompressionLevel = PdfCompressionLevel.Normal;
pdfConverter.PdfDocumentOptions.PdfPageOrientation = PDFPageOrientation.Portrait;
pdfConverter.PdfDocumentOptions.ShowHeader = false;
pdfConverter.PdfDocumentOptions.ShowFooter = false;

pdfConverter.PdfDocumentOptions.GenerateSelectablePdf = selectablePDF;

// Performs the conversion and get the pdf document bytes that you can further
// save to a file or send as a browser response
byte[] pdfBytes = pdfConverter.GetPdfFromUrlBytes(urlToConvert);

// send the PDF document as a response to the browser for download
System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;
response.Clear();
response.AddHeader("Content-Type", "binary/octet-stream");
response.AddHeader("Content-Disposition",
"attachment; filename=ConversionResult.pdf; size=" + pdfBytes.Length.ToString());
response.Flush();
response.BinaryWrite(pdfBytes);
response.Flush();
response.End();
fchivu at 2007-11-11 21:52:21 >
# 6 Re: Help with HTML to PDF conversion with VB.net
Hi,

The new version 3.2.3 of the Winnovative HTML to PDF converter library for .NET (http://www.dotnet-reporting.com) is now faster and has a lot of new features like CSS page breaks, keep together, password protection, embedded fonts.
Here you can see all the new HTML to PDF converter (http://www.winnovative-software.com) features. If you liked the version 2.x you'll love 3.2.3.

Regards,
Florin
fchivu at 2007-11-11 21:53:23 >