htmlToPdf static method
dynamic
htmlToPdf(})
Implementation
static htmlToPdf(String html,{Function? callback,Map<String,dynamic >pageSettings=const {}})async{
_debug("Generating pdf from html");
html=html.replaceAll("</body>", '<script>console.log("report generated");</script></body>');
Page page=await browser.newPage();
_debug("Created page");
page.onConsole.listen((event) async {
if(event.text!=null) {
_debug(event.text);
if(event.text=="report generated"){
}
}
});
_debug("Setting Html");
await page.setContent(html,wait: Until.networkIdle,);
_debug("Html Set");
await pagePdf(page,callback: callback,pageSettings: pageSettings);
page.close();
}