Altair
Altair

Reputation: 355

How to run the PhantomJS script from Java-EE application without specification of script full path?

I need to convert some HTML content to PDF or image in my server side app Java EE. For this, I am using the PhantomJS and script "resterize.js".

Problem is, that I need to specify the path of the rasterize.js script. I would like to use only command like this:

phantomjs rasterize.js "https://google.com" test.pdf [my another arguments]

I found it is possible to use GhostDriver and include it into the Java app, but then I dont know, if it is possible to run same rasterize.js script.

Thanks for any answer.

Upvotes: 0

Views: 46

Answers (1)

djjoman
djjoman

Reputation: 16

If you don't want to specify the full path in your app, you can define it into an environment variable and then read it like this:

String base_path = System.getenv("script_base_path");

Does it help you ?

Upvotes: 0

Related Questions