knpSnappy and symfony ux chartjs

72 Views Asked by At

I'm trying to create a PDF with snappy, everything works fine except for displaying my chart.

I checked that javascript is activated on the PDF and it is, I use stimulus for javascript.

Here are some lines to understand my code.

Generate pdf with snappy :

$knpSnappyPdf->getOutputFromHtml($quotation, [
                'header-html' => $header,
                'footer-html' => $footer,
                'encoding' => 'utf-8',
                'margin-left' => 0,
                'margin-right' => 0,
                'margin-top' => 28,
                'margin-bottom' => 18,
                'enable-javascript' => true,
                'javascript-delay' => 1000,
                'no-stop-slow-scripts' => true
            ]),

And my html file pdf :

 <div class="card border border-1 border-gray-400">
        <div class="card-body pb-3">
            {{ render_chart(summaryChart) }}
        </div>
    </div>

the summaryChart variable went well in my pdf during generation, only it does not show me the graph at all, I tried to put the javascript code directly in the html file but without success, have you ever had this problem?

0

There are 0 best solutions below