Last post Aug 21, 2017 04:18 PM by atpincorporation
Mar 05, 2013 07:17 PM|uri3000|LINK
Anyone knows How can i convert HTML with external CSS to a nicely styled PDF in under 200$??
i found a couple of solutions but they all cost more than a 1000$ for a webfarm/company license and its too expensive for me.
Mar 05, 2013 07:33 PM|CodeHobo|LINK
iTextSharp can do this for you and it's open source.
Mar 05, 2013 07:36 PM|uri3000|LINK
Does it load external CSS files from the HTML and convert it to PDF styling?
(it didn't work for me)
Mar 05, 2013 07:44 PM|CPrakash82|LINK
I guess it is not supported by default or has limited support, a while back when I was using it, it didn't had CSS support. You might want to try add on - XML Worker, might help.
Mar 05, 2013 07:47 PM|uri3000|LINK
Yeah i really gotta have the CSS support but thanks for the help. anyway, i've found something that looks promising:
http://www.htmltopdfasp.net i'm gonna try this now. They say that they support external CSS, inline styles and URL rendering and they're under 100$ for an unlimited use license... hope it works!
BTW I Just posted about it on a different thread :)
Apr 10, 2013 01:39 AM|Joseph Barnes|LINK
If you're creating a commercial project you may want to look at
Elerium HTML to PDF .NET component. It allows to convert html string/file/url to PDF including styles.
Disclaimer: I'm a developer at Elerium Software.
Apr 10, 2013 04:37 AM|uri3000|LINK
Actually i decided to create such a component for my own use. Do you have a recommendation for me? i don't even know where to start... Should i be implementing the entire parsing and rendering of the HTML or can i use an existing HTML renderer somehow? and
if yes, then which one is best to use?
Can it be a .NET native component?
Thank you very much!
Apr 11, 2013 12:33 AM|Joseph Barnes|LINK
You can use XmlReader to parse HTML. If you want to convert HTML elements into PDF, you need to be familiar with PDF format. You can download the PDF reference from adobe.com website. What why I recommend you some 3rd party tools to convert HTML to PDF or
render it to any other format.
Also here is the similar question:
Apr 11, 2013 12:49 AM|bruce (sqlwork.com)|LINK
be sure to check that the library you pick supports being called from a web application. most of the html to pdf with css support that actually work use an IE instance and a custom print driver (the driver sends the pdf data back to the caller). as IE was
never design to be hosted by server process, there are often issues.
there is an open source solution based on webkit
Aug 21, 2017 04:18 PM|atpincorporation|LINK
You may want to use this pdf component for .net
to convert HTML to PDF. You may ask the vendor for a discount to match your price. Here is the example code to convert:
HtmlToPdfConverter pdfConverter = new HtmlToPdfConverter();
pdfConverter.PdfDocumentSettings.ShowHeader = false;
// Convert a web page to a PDF file
// pdfConverter.ConvertUrlToFile(url, AppDomain.CurrentDomain.BaseDirectory + "Output.pdf");
// Or you can allow user to open the converted document in the client browser
byte downloadBytes = pdfConverter.ConvertUrl(url);
// Set response content type
// Instruct the browser to open the PDF file as an attachment or inline
Response.AddHeader("Content-Disposition", "attachment; filename=Output.pdf; size=" + downloadBytes.Length.ToString());
// Write the PDF document buffer to HTTP response
// End the HTTP response and stop the current page processing