0

The current page getting blank whenever i download pdf file in vf page.Here is my code: enter image description here

This is the UI code:

 <button aria-live="assertive"
                class="slds-button slds-button--neutral slds-not-selected"
                id="pdfView">Export as PDF</button>

javascript function:

 $('#pdfView').click
            (
                function()
                {
                    var param = 'apex/Invention_Disclosure_PDF?id='+getParameterByName("id");           
                    redirectToURL(param);
                }
            );

Current page is getting blank and then pdf file is downloading,how to avoid this

1 Answer 1

1

You could simply use an anchor tag instead of a button and style it as a button, you could even use the download attribute to give the browser an extra hint that it's a file download.

Assuming you page is using the Standard Controller for your object then it would look something like this:

<a aria-live="assertive"
    class="slds-button slds-button--neutral slds-not-selected"
    href="/apex/Invention_Disclosure_PDF?id={!Object_Name__c.Id}"
    download="true">Export as PDF</a>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .