javascript 寻找使用客户端生成 pdf 的解决方案(angular js)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23336357/
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
looking for a solution for generating pdf with client side (angular js)
提问by Abder-Edrs
I am looking for a solution to generate pdf from (html + css + javascript) using AngularJs.
我正在寻找一种使用 AngularJs 从(html + css + javascript)生成 pdf 的解决方案。
I tested two solutions:
我测试了两种解决方案:
- jsPDF (it does not take the css)
- Shrimp (based on Ruby)
- jsPDF(它不需要css)
- 虾(基于 Ruby)
which do not work for me.
这对我不起作用。
How can I do it?
我该怎么做?
采纳答案by Abder-Edrs
After all this, I discovered the excellent PhantomJS.
在这一切之后,我发现了优秀的PhantomJS。
The binary was easily installed on the server with no additional dependencies required, and came with a great deal of example code, including a working ‘print to PDF' function out-of-the-box. With some minor tweaks, we customized the script for our use case, and had a PDF copy of our webpages in minutes. PhantomJS has been around since 2011 and is used by a variety of open source products, listed on their websit
二进制文件很容易安装在服务器上,不需要额外的依赖项,并附带大量示例代码,包括开箱即用的“打印到 PDF”功能。通过一些细微的调整,我们为我们的用例定制了脚本,并在几分钟内获得了我们网页的 PDF 副本。PhantomJS 自 2011 年以来一直存在,并被各种开源产品使用,列在他们的网站上