Reputation: 1971
I would like to render map file in the back with a .Net Core project
So, the purpose is to execute Highmaps library on a Javascript middleware, and export the svg file to the "node-export-server".
I have a API which receive from the client some data. I would like to generate the SVG map file with Highmap library and then send to anonother API which will contain a middleware to execute the node module gor the PNG/JPG/... export.
What is the way to pass a svg file to the "node-export-server" module ? I read the associate docs but I didn't found the way... (https://github.com/highcharts/node-export-server/blob/master/README.md)
I would like to pass my SVG file with this sample.
//Include the exporter module
const exporter = require('highcharts-export-server');
//Export settings
var exportSettings = {
type: 'png',
options: {
title: {
text: 'My Chart'
},
xAxis: {
categories: ["Jan", "Feb", "Mar", "Apr", "Mar", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
},
series: [
{
type: 'line',
data: [1, 3, 2, 4]
},
{
type: 'line',
data: [5, 3, 4, 2]
}
]
}
};
//Set up a pool of PhantomJS workers
exporter.initPool();
//Perform an export
/*
Export settings corresponds to the available CLI arguments described
above.
*/
exporter.export(exportSettings, function (err, res) {
//The export result is now in res.
//If the output is not PDF or SVG, it will be base64 encoded (res.data).
//If the output is a PDF or SVG, it will contain a filename (res.filename).
//Kill the pool when we're done with it, and exit the application
exporter.killPool();
process.exit(1);
});
Upvotes: 7
Views: 1068
Reputation: 1040
Well this might not be exactly the full answer, but it may guide you in the right direction: Take a look at https://github.com/aspnet/JavaScriptServices which provide a way to pass code to nodejs (even though it is about server side rendering, the principle is similar). Then you can pass arguments to nodejs the "same way" you may pass it through CLI.
Upvotes: 1