Open uvarajgithub opened 4 years ago
add to mail PDF version ;-)
let exec = require('child_process'); let locateChrome = require('locate-chrome'); let q = require('q'); let reportFolder = ''; let reportName=''; return q.fcall(() => { locateChrome((where) => { // Print pdf report from html report console.log('Converting html report to pdf file'); exec.execSync('"' + where + '"' + ' --headless --disable-gpu --print-to-pdf=' + reportFolder + '/' + reportName + '.pdf --no-margins ' + reportFolder + '/' + reportName + '.html'); }); }).delay(1000);
The pdf approach from rebajz is good. The other alternative would be to zip all files and then send the zip files as mail. This report does not work without "support" files. The js and css files are all required.
After report .html file generated if i copy the path and paste it to browser and launch i will get report like below
but, if i want to mail the report when i open from mail the reports looks like
The problem is default report path has support css json files with it. But if i copy the file to some other place and try to open it its broken design..with out support files Same thing happen when i sending a mail of the report.html file alone...it is broken with out css and json contetns..
How to resolve this issue