I have a code as follow:
var info = {
"Company": "ABC",
"Team": "JsonNode",
"Number": 4,
"Time": "1 day"
};
var layout = "<ol><li>Info: </li><ol><ul>Company: {{info.Company}}</ul><ul>Team: {{info.Team}}</ul></ol><li>Number: {{info.Number}}</li><li>Time: {{info.Time}}</li><ol>";
function generatePdf(layout,info)
{
var wkhtmltopdf = require('wkhtmltopdf');
console.log('generating pdf');
wkhtmltopdf(layout, {
//console.log('debug');
output: './file.pdf',
"viewport-size": "1280x1024",
"page-width": "400",
"page-height": "600"
});
}
generatePdf(layout,info);
And now I can generate a pdf file but pdf file's content is not right. is is:
1. Info:
Company: {{info.Company}}
Team: {{info.Team}}
2. Number: {{info.Number}}
3. Time: {{info.Time}}
My problems here are:
1: How to separate html template(var layout) to a file.
2: info.Company must be ABC, info.Number must be 4
Please give me a help!
ulandolelements and some data isn't even inside anli(that stands for list item if that gives you an indication of whats going on) - Also, how does company info with a submenu count every thing in the submenu as if its in the main menu (aka how cannumberbe 4 when its the second in the primary list?)<>in it)