Button for exporting dashboard to PDF format


I have a button for exporting my dashboard to pdf format using URL
But when I put the dashboard URL it exports a blank page …
I tried with “google.fr” and it works I have a pdf with the google main page
This is my code :

export_as_pdf = st.button(“Export Report”)

if export_as_pdf:

path_wkhtmltopdf = r'C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe'
config = pdfkit.configuration(wkhtmltopdf=path_wkhtmltopdf)
pdfkit.from_url("http://XX.XXX.XXX.XXX:XXXX", "dashboard.pdf", configuration=config) #Blank page
pdfkit.from_url("google.fr", "google.pdf", configuration=config) #It works