Plots to PDF file

Hi, I am using the Django application to generate some graphs using Plotly so

I tried to generate a pdf file of the following plots page
my HTML page is:

        <center> <p class="lead"><strong><em>&nbsp;All Plots&nbsp;</em></strong></p></center>
        <div class="row">
            <div class="col-md-6" >
                {{ sunburst|safe}}
            <div class="col-md-6" >
                {{ sunburst2|safe}}

and my :

    path('export_pdf/', views.export_pdf, name='export_pdf'),

and the;

def export_pdf(request):
    df ="country=='Canada'")
    fig = px.line(df, x="year", y="lifeExp", title='Life expectancy in Canada')
    df2 ="continent=='Oceania'")
    fig2 = px.line(df2, x="year", y="lifeExp", color='country')

    chart = fig.to_html()
    chart2 = fig2.to_html()
    context= {
    return render(request, 'Home/Reporting/part_pdf.html',context)

I tried some code from this page but I can’t generate the file any help?

are there any other methods to do that (html page with plots and tables)?

All my best