[SalesForce] How to render a part of page as Pdf

I have a page that will be rendered as a PDF and the bottom of page will contain Button as Send which will send a PDF to account's email.Is it possible to render a part of a Visualforce page as PDF.

Best Answer

Instead of duplication of the page, as suggested by one of the answers, I would suggest to add some parameter to url called render (for example).

Then, in page definition, you can use next construction:

<apex:page 
renderAs="{!IF(ISNULL($CurrentPage.parameters.render),'',$CurrentPagePage.parameters.render)} 
... />

Then about sections. Lets say you have some outputPanel or another block that you don't want to display on PDF. You can easily do:

<apex:outputPanel layout="none" rendered="{!IF($CurrentPage.parameters.render = 'pdf',false, true)} />

Using that approach, you can hide/show sections based render type on demand.

Then, as a result, if you open your page as /apex/Mypage?<some params>&render=pdf - it would be rendered as pdf, and if /apex/MyPage?<some params> - it would be rendered as html