其实有很多这样的开源项目的,我接触过。你到网上搜搜,我记得有个Verypdf中,有个一htmltools,可以把单纯的网页文件转换为pdf,也可讲一个URL保存为pdf,希望能帮到你。
下载ITEXTSHARP
Document document = new Document(PageSize.A4, 10, 10, 10, 10);
MemoryStream ms = new MemoryStream();
PdfWriter writer = PdfWriter.GetInstance(document, ms);
StringReader se = new StringReader(htmlDisplayText);
HTMLWorker obj = new HTMLWorker(document);
document.Open();
obj.Parse(se);
document.Close();
Response.Clear();
Response.AddHeader("content-disposition", "attachment; filename=report.pdf");
Response.ContentType = "application/pdf";
Response.Buffer = true;
Response.OutputStream.Write(ms.GetBuffer(), 0, ms.GetBuffer().Length);
Response.OutputStream.Flush();
Response.End();