How do I convert a visualforce page to a PDF? Please provide a code sample.
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
You can use : apex:page renderAs="pdf" showHeader="false"
Than whenever that page open it download as a pdf
If you need not only convert your page to PDF but save this file with a specific name here is a workaround. You will need two pages – the first page generates an PDF file and the second saves it with specific filename:
The main "wrapper" page saves PDF and gives a filename:
PageThatGeneratesPdf – only generates PDF content: