问题
Is there an easy way to have an HTML form on a webpage that, when the user submits, puts the data into a PDF file and sends it to the receiver?
The webpage is running on .net.
Thanks
回答1:
Umbraco has a good PDF generator package called "XSL to PDF".
It wil allow you to generate a PDF file from Umbraco just by defining a PDF template.
Using this you should be able to achieve what you are looking for.
回答2:
If you have C# use one of this libraries : http://csharp-source.net/open-source/pdf-libraries
(I don't use dot net, so I can't really recommend any, sorry)
回答3:
I have been using PDFsharp a lot.. Does the job!
回答4:
Have you tried "PDF Vision .Net"? It's a commercial library but the costs of paying justify itself :) Only $150. I think you should try it.
Use this code for the HTML to PDF converting in Asp .NET/C#:
SautinSoft.PdfVision obj = new SautinSoft.PdfVision();
obj.PageStyle.PageSize.A4();
byte [] pdf = obj.ConvertHtmlFileToPDFStream(@"http://www.somesite.com");
if (pdf!= null)
{
Response.Buffer = true;
Response.Clear();
Response.ContentType = "application/PDF";
Response.AddHeader("Content-Disposition:", "attachment; filename=Result.pdf");
Response.BinaryWrite(pdf);
Response.Flush();
Response.End();
回答5:
Disclaimer: I'm working for this company.
I can also mention another great product of Sautinsoft company. I think you should check them both and then choose the best! The library quite well doing their job and doesn't require any additional components.
PDF Metamorphosis .Net
This component
HTML to PDF in C#:
SautinSoft.PdfMetamorphosis p = new SautinSoft.PdfMetamorphosis();
p.PageStyle.PageSize.A4();
p.HtmlToPdfConvertFile(@"c:\table.html", @"c:\Result.pdf");
来源:https://stackoverflow.com/questions/5613392/from-html-form-to-pdf