javascript 如何使用javascript将Html页面转换为PDF

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19782642/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 16:45:46  来源:igfitidea点击:

How to Convert Html Page to PDF using javascript

javascriptpdf

提问by Navyah

I have a java Application which view few results in a web page , I want to save those results into PDF file which user click on a button "Export to PDF" Button. Can any one please help me to use which technology. I am really aware of this.

我有一个 java 应用程序,它在网页中查看很少的结果,我想将这些结果保存到 PDF 文件中,用户单击按钮“导出为 PDF”按钮。任何人都可以帮助我使用哪种技术。我真的很清楚这一点。

回答by Ayyappan Sekar

The simple and best way is to make use of existing libraries. You can get it done either in server side or in client side. If you choose the server side, go for iText PDF ApiOtherwise you can use jspdf. Both will provide their own methods, you could use it.

最简单和最好的方法是利用现有的库。您可以在服务器端或客户端完成它。如果您选择服务器端,请使用iText PDF Api否则您可以使用jspdf。两者都会提供自己的方法,您可以使用它。