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
vivek singh08481200707119766vivek singh08481200707119766 

Hi friend ,my problem is when we make a visual force page and how to convert in pdf in this page plese reply

Best Answer chosen by vivek singh08481200707119766
SFDC_DevloperSFDC_Devloper
Hi Vivek,

Visualforce Page
<apex:page controller="PdfExampleController" renderAs="pdf">
  <apex:form >
    <apex:pageBlock >
        <apex:pageBlockTable value="{!accList}" var="acc" border="2">
           <apex:column value="{!acc.name}"/>
           <apex:column value="{!acc.annualrevenue}"/>
           <apex:column value="{!acc.type}"/>
           <apex:column value="{!acc.accountnumber}"/>
           <apex:column value="{!acc.rating}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
  </apex:form>
</apex:page>
Controller
public with sharing class PdfExampleController {
    public List accList{get;set;}
    public PdfExampleController (){
        accList = [select id,name,type,accountnumber,annualrevenue,Rating from account limit 10];
    }
}
Output
User-added image

   
    [If it helps, mark it as "Best Answer"]

Thanks,
Rockzz


All Answers

Sri549Sri549
Hello Vivek,
As per our requirment ,we can reach a solution as like putting renderAs="Pdf" in the page tag.
the vf p-page content will showing in pdf itself.

Reply me,if doesnt solve your requirment.
or Mark it as kudos for other Benefits

Thanks 
Srinivas
SFDC Developer.
SFDC_DevloperSFDC_Devloper
Hi Vivek,

Visualforce Page
<apex:page controller="PdfExampleController" renderAs="pdf">
  <apex:form >
    <apex:pageBlock >
        <apex:pageBlockTable value="{!accList}" var="acc" border="2">
           <apex:column value="{!acc.name}"/>
           <apex:column value="{!acc.annualrevenue}"/>
           <apex:column value="{!acc.type}"/>
           <apex:column value="{!acc.accountnumber}"/>
           <apex:column value="{!acc.rating}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
  </apex:form>
</apex:page>
Controller
public with sharing class PdfExampleController {
    public List accList{get;set;}
    public PdfExampleController (){
        accList = [select id,name,type,accountnumber,annualrevenue,Rating from account limit 10];
    }
}
Output
User-added image

   
    [If it helps, mark it as "Best Answer"]

Thanks,
Rockzz


This was selected as the best answer