I am generating a pdf invoice with visualforce, but when it downloads there is no file extension. I have read other questions on SE and tried to simplify the content. Right now the code is simplified to

<apex:page standardController="Invoice__c" renderAs="pdf">



and the file extension is still not added to the file.

  • What browser is it? Sep 4 '14 at 10:27
  • I use firefox 24.2.0
    – dnbrobin
    Sep 4 '14 at 10:37
  • Are you on the beta programme for PDF2?
    – Francis
    Sep 4 '14 at 11:44

You can set the name and extension of the PDF explicitly as follows, for example

Apexpages.currentPage().getHeaders().put('content-disposition', 'attachment; filename=AccountReport.pdf');

Unfortunately this is directly not supported in tag in Visualforce.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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