I'm sending emails that have invoices attached as PDFs. I'm already - elsewhere in the application - creating the invoices in an .aspx page. I'd like to use Server.Execute to return the output HTML and generate a PDF from that. Otherwise, I'd have to use a reporting tool to "draw" the invoice on a PDF. That blows for lots of reasons, not the least of which is that I'd have to update both the .aspx page and the report for every minor change. What to do...
相关问题
- Views base64 encoded blob in HTML with PHP
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Carriage Return (ASCII chr 13) is missing from tex
- Why am I getting UnauthorizedAccessException on th
As long as you can make sure to use proper XHTML, you could also use a product like Alt-Soft's Xml2PDF to convert XML (XHTML) into PDF by means of XSLT/XSL-FO.
It takes a bit of a learning curve to master, but it works very well once you've "got" it!
Marc
I'd go a different route. Assuming you are using SQL Server, use SSRS and generate the PDF that way.
We use a product called ABCPDF for this and it works fantastic.
http://www.websupergoo.com/abcpdf-1.htm
wkhtmltopdf is a free and cool exe to generate pdf from html. Its written in c++. But nReco htmltopdf is a wrapper dotnet library for this awesome tool. I implemented using this dotnet library and it was just so good it does everything by its own you just need to give html as a data source.
The above function is an excerpt from the below link post which explains it in detail. HTML to PDF in ASP.Net
If you try to find some html to pdf software via GOOGLE you'll get a pile of this stuff. There are about 10 leaders but most of them use IE dlls in background mode. Just couple of them use their own parsing engine. Please try PDF Duo .NET component in your ASP.NET project if you wish to create a PDF programaticaly. It is light component for a cool generating of PDF invoces, reports e.g.
There is no way to generate a PDF from an HTML string directly within .NET, but there are number of third party controls that work well.
I've had success with this one: http://www.html-to-pdf.net and this: http://www.htmltopdfasp.net
The important questions to ask are:
There are a few others but they deal with ActiveX displays and such.