jsreport not rendered or not render properly when crete pdf
-
<html>
<head>
<meta charset="UTF-8">
</head>
<script src="https://code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://168.jsreportonline.net/extension/browser-client/public/js/jsreport.min.js"></script><script src="https://code.highcharts.com/highcharts.src.js"></script>
<script></script>
<style>
.page-break { display: block; page-break-before: always; }{#asset pdf_style.css @encoding=utf8}
</style>
<body><div id="container" class="page-break"></div>
</div>
</body>
<script>
$(function(){Highcharts.setOptions({ lang: { thousandsSep: '.' } }); var chart = Highcharts.chart('container', { chart: { plotBackgroundColor: null, plotBorderWidth: null, plotShadow: false, type: 'pie' }, credits:{ enabled:false }, title: { text: "My test" }, plotOptions: { pie: { allowPointSelect: false, cursor: 'pointer', dataLabels: { enabled: true, formatter: function() { return Highcharts.numberFormat(this.y, 0, '.'); } }, showInLegend: true } }, series: [{ colorByPoint: true, data:{{{toJSON b.chart }}} }] },function(chart){ window.JSREPORT_READY_TO_START = true
});
jsreport.render({content:document.documentElement.outerHTML,engine:"jsrender",recipe:"phantom-pdf",phantom: {WaitForJS: true }}); });
</script>
</html>With the above code the pdf which created render only legend of highchart and not chart.
![0_1564407682653_Capture.PNG](Uploading 100%)
I have tryed many things but nothink works any help?
Thanks in advance
-
The image of pdf is this : https://ibb.co/FnDdyGP
-
seem to say at jsreport you page is ready before the pie is rendered
try withsetTimeout( function () { window.JSREPORT_READY_TO_START = true; }, 3000); });
-
Thank you for reply i fined it by using this code in highcharts
series: {
animation: {
complete: function () {
window.JSREPORT_READY_TO_START = wait
}
},