Download component as image using clientside_callback shows how to download the html on the page as an image using html2canvas, I believe the process is similar using html2pdf; however, I have not tested saving as pdf.
Download component as image using clientside_callback shows how to download the html on the page as an image using html2canvas, I believe the process is similar using html2pdf; however, I have not tested saving as pdf.