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
rohitrrohitr 

Render part of VF page as pdf

Is it possible to render part of a VF page as pdf.

I don't want the entire page to be rendered as pdf because the user should have an option to select a date on the VF page. On selecting the date, the bottom part must be rendered as pdf.

 

How can i achieve this?

 

Thanks in Advance,

Rohit R

Rahul SharmaRahul Sharma
Mostly it is handled with use of two pages, In first page we select the filter criteria having a button. Onclick of button display the PDF with the result of filter criteria.
rohitrrohitr

Thanks Rahul,

 

But how can i call the another page when i click a button.

 

I've a date to be chosen on first page absed on which controller has to fetch records from an object and display in another page rendered as pdf.

 

How can this be achieved?

 

Regards,

Rohit R

samreet_matharu@psl.co.insamreet_matharu@psl.co.in

We had a similar requirement in which we need to use same  Vf page as PDF and normal page.

We added a parameter in the URL to distinguish if the page was rendered as PDF and then controlled/dynamically rendered components in the page as per the parameter

 

<apex:page renderAs="{!IF($CurrentPage.parameters.isPDF == null, null, 'pdf')}">

 <! other content --!>

<apex:commandLink action="{!URLFOR($Action.student__c.view,student.id)}" value="Back To Student" rendered="{!IF($CurrentPage.parameters.isPDF== null ,true,false) }"/>

 

</apex:page>