MVC-如何将HTML保存为Word或PDF [英] MVC - How to save html as word or pdf

查看:195
本文介绍了MVC-如何将HTML保存为Word或PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以分享一个很好的示例,说明如何使用ASP.NET MVC将html内容另存为Word或Pdf文件吗?我在查看"页面上向用户显示结果摘要.我想提供一个功能,通过单击保存"按钮以Word/Pdf格式保存此摘要.

我读到有关设置内容处置以及其他第三方dll(例如evopdf等)的信息.但是在实际中如何使用它并不是一个安静的过程.某些示例代码肯定会对我有所帮助.

在此先感谢

Can anybody please share a good example of how to save html content as Word or Pdf file using ASP.NET MVC? I am showing a result summary to user on my View page. I want to give a feature to save this summary in Word / Pdf format on click of "save" button.

I read about setting the content-disposition, and other third party dll''s (like evopdf, etc) to achieve this. But not quiet getting how to use it in reality. Some sample code will surely help me.

Thanks in advance

推荐答案

.Net没有内置的PDF支持.您需要为此使用第三方组件.查看设置单词 [ ^ ](它也支持转换为PDF),效果很好.
.Net does not have a inbuilt PDF support. You need to use a third party component for this. Check out Google[^], there are lot of free/paid components available.

I have used Aspose Words [^](it supports conversion to PDF as well), works quite well.


^ ]
使用ASP.NET从HTML页面生成PDF文档 [ ^ ]
http://forums.asp.net/t/1199774.aspx [
http://dotnet-magic.blogspot.com/2010/07/convert-html-to-word-document-using.html[^]
Generate PDF documents from a HTML page using ASP.NET[^]
http://forums.asp.net/t/1199774.aspx[^]


如前所述,.Net没有内置支持.
您需要第三方组件来满足您的需求.

检查网址,
http://csharp-source.net/open-source/pdf-libraries [ ^ ]

您还可以检查evopdf(尽管它不是免费的,但是可以肯定地满足您的所有要求)

希望这会有所帮助
欢呼
As already answered, .Net has no inbuilt support.
You need 3rd party components to cater your needs.

Check the url,
http://csharp-source.net/open-source/pdf-libraries[^]

You can also check evopdf(which is not free though, but will cater all your requirements for sure)

Hope this helps
cheers


这篇关于MVC-如何将HTML保存为Word或PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆