For those of you who work with JavaScript on the server side, our Open Source export server is now available as a node.js app. The server is backwards-compatible with the existing Java solution (which continues to be maintained), but it also has a few additional tricks up its sleeve.
The node.js version simplifies installation considerably – no more Batik or Maven configurations, and no more PhantomJS setup; just run npm install -g highcharts-export-server
, and you’re all set!
Both versions of the Export server are licensed under the MIT license.
DUAL CLI + HTTP(S) MODE
As with the Java export server, the node one can run either as a command line interface, or as a stand-alone http(s) server. The command line switches (and POST options if running in server mode) are fully compatible with the existing export servers – with a few additional ones.
The CLI mode also replaces the old highcharts-convert.js
PhantomJS script.
NEW FEATURES
Simplified installation
The export server can now be installed through a single command: npm install -g highcharts-export-server
. This will pull in and install all the parts necessary to use it, and add the server itself to your path. Afterwards, simply call highcharts-export-server [options]
from the command line (the available options can be found here), and you’ll be generating charts in no time.
Base64 and binary output
The export server can now output directly to binary or base64 in addition to URL’s to generated charts. To get base64 output from the server, simply add b64 = true
to the post body.
Complete logging
When running in server mode, it’s often useful to be able to get varying degrees of log output for troubleshooting issues. Adding the --logLevel
switch allows you to set the verbosity of the output, from disabled (0), to very verbose (4). It can log to file too – simply add --logDest <path>
; when starting the server.
CLI batch converting
It’s now possible to process multiple charts at once when running in CLI mode. This increases performance dramatically when needing to convert several charts thanks to the PhantomJS pooling mechanism utilized by the service which decreases the overhead of spawning PhantomJS processes. Add --batch “chart1.json=chart1.png;chart2.json=chart2.png;...”
and your off! Note that when doing batch conversions the same options will be used for all input charts. So you can’t convert some charts to png and some to pdf in the same job.
SSL/HTTPS Support
Usually when running web-services, they’re behind a load balancer or some other form of delegator which takes care of the SSL side of things during routing. However, for smaller deployments, such a setup could easily be overkill. To that end, the export server also supports running in TLS mode. The setup for this is as easy as can be – just add the --sslPath <path to crt/key files>
switch when starting the server.
Node.js module interface
For tight integration with existing node.js solutions, the export server can also be used as a node.js module. This allows you to easily add chart conversion support to e.g. your report generator system, or any other node.js-based backend services. Just add the server as a dependency to your project ( npm install higcharts-export-server --save
) and include the module in your service. For a detailed example on how to do integrate with the node module, please see https://github.com/highcharts/node-export-server.
PRODUCTION READY
The node server has been serving requests on export.highcharts.com for several weeks, and is thus production ready.
TAKE IT FOR A SPIN
Ready to try it out? Head over to https://github.com/highcharts/node-export-server, where you’ll find the source and complete documentation.
Comments
BIJAL MANDVIYA | 1 year ago
does ‘node-export-server’ in node.js moves data out to highcharts.com server to export highchart into svg/jppg ?
Mustapha Mekhatria | 1 year ago
Hi,
When you install the https://github.com/highcharts/node-export-server on your own hardware, it handles all the exporting internally, so nothing is sent to highcharts.com.
Vikram Aditya | 1 year ago
Hi,
After using this node package, I receive a error saying that ‘Export server not configured! ……….’
Can you please tell me how to proceed further.
Mustapha Mekhatria | 1 year ago
Hi,
Feel free to check our forum https://www.highcharts.com/forum/index.php
Want to leave a comment?
Comments are moderated. They will publish only if they add to the discussion in a constructive way. Please be polite.