Downloading plots as pdf or image using plotly dash via Jupyter

I have been trying using JupyterDash to create a plotly dash. I have a dataset and created plots based on certain conditions. My problem is, I want to give the user the chance to download the generated plots. However, whenever I click the button that I created to download the generated plot as a pdf file, all I get is an empty or damaged file. Does anyone have an idea on how to resolve the issue? I can share my code here if needed.