I am writing a reporting app wherein I need the output in PDF format. I am planning to generate a webpage and call PhantomJS on that webpage to get the PDF. However, for this to work users will have to install PhantomJS (+ NodeJs) libraries as well.
我正在编写一个报告应用程序,其中我需要PDF格式的输出。我打算生成一个网页,并在那个网页上调用PhantomJS来获取PDF。但是,对于这个工作,用户将不得不安装PhantomJS (+ node . js)库。
Why don't I just ask them to print the webpage as PDF? They both (PhantomJS and Browser's Print function) shall produce the same output, right?
为什么我不让他们把网页打印成PDF?它们(PhantomJS和浏览器的打印功能)将产生相同的输出,对吧?
1 个解决方案
#1
0
Yes chrome browser should print to PDF fine and better than phantomjs is some cases.
是的,chrome浏览器应该打印成PDF格式,比phantomjs更好。
But you can use phantomJS in the server to generate the PDF, so user doesn't need phantomJS installed on his machine, and could be used from Firefox,IE,Safari,Mobile, etc..
但是您可以在服务器中使用phantomJS来生成PDF,因此用户不需要在自己的机器上安装phantomJS,可以在Firefox、IE、Safari、移动设备上使用。
So it is back to your environment and your requirements
回到你的环境和需求
#1
0
Yes chrome browser should print to PDF fine and better than phantomjs is some cases.
是的,chrome浏览器应该打印成PDF格式,比phantomjs更好。
But you can use phantomJS in the server to generate the PDF, so user doesn't need phantomJS installed on his machine, and could be used from Firefox,IE,Safari,Mobile, etc..
但是您可以在服务器中使用phantomJS来生成PDF,因此用户不需要在自己的机器上安装phantomJS,可以在Firefox、IE、Safari、移动设备上使用。
So it is back to your environment and your requirements
回到你的环境和需求