function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
İrem Günerİrem Güner 

Setting a dynamic pdf filename to my visualforce page


I would like to set a dynamic pdf filename to my visualforce page

The code is below, however this code still generated pdf with visualforce page generic name?
(This code is Just to test to set a different static file name, bu it does not work)

I appreciate an comment or advice


<apex:page standardController="Invoice1__c" showHeader="true" renderAs="pdf" language="tr">


public Invoice1__c()
{
    PageReference p =
Apexpages.currentPage().getHeaders().put('content-disposition', 'attachment; filename=AccountReport.pdf');
}

// my main code is here //

...


</apex:page> 
AshwaniAshwani
Did you tried using like this:

<apex:page standardController="Invoice1__c" showHeader="true" renderAs="pdf" language="tr" contenttype="application/pdf#AccountReport.pdf">
Just a guess!

İrem Günerİrem Güner
Hi,  it is not working för pdf file types 😟