Can I use PhantomJS as a client library?

I am currently evaluating various libraries for exporting HTML to PDF. Some of them implement HTML to PDF conversion, but it is marked as experimental.

PhantomJS sounds like a solid option, but I don’t know for sure whether it is possible to create a PDF file on the client side, so ... is it possible? as?

+6
source share
1 answer

No, PhantomJS is a complete standalone browser. If you like to compile PhantomJS with emscripten in JavaScript and then run it in a browser, you can try, but it will probably be difficult to do.

The easiest way is to start the PhantomJS server, which accepts the HTML code to be displayed and returns the resulting PDF file. For this PhantomJS provides a web server . Of course, you can use PhantomJS with the appropriate node.js server through a bridge, such as phantom .

+9
source

Source: https://habr.com/ru/post/983528/


All Articles