Can someone help me to download a VF page when the user clicks on the download button? Current functionality is when the user clicks on the download button it will take the user to Print page and user needs to save the document as pdf on the selected folder. I would like to update that to download directly when the user clicks on the download button. Thank you

The print code is as below

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
    $(document).ready(function() {
        document.title = '{!Name} - Report';

Check out the best answer on this Salesforce developer post: Visualforce page download as a PDF when Button click

The post is about a similar use case and the answer is well described with some sample code

  • Thank you for your help. It worked but I had to add a different method for the code provided. – Abby Jul 23 '19 at 23:38

Not the answer you're looking for? Browse other questions tagged or ask your own question.