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
Jannu SairamJannu Sairam 

I want to get a list of records for an object based on input field(created date) as a pdf(table format) from vf page

VinayVinay (Salesforce Developers) 
Hi Sairam,

Can you check below similar example.

https://developer.salesforce.com/forums/?id=906F00000009FK9IAM

Please mark as Best Answer if above information was helpful.

Thanks,
SFDC12SFDC12
Hi ,
apex:
public class Accountrecs {
    private Apexpages.StandardController controller;
    
    public Accountrecs(Apexpages.StandardController controller){
        this.controller=controller;
    }
    public List<Account> getAccounts(){
        return[select id,name,CreatedDate,phone from Account  ORDER BY CreatedDate DESC];
    }
}

vf:
<apex:page standardController="Account" renderAs="PDF" standardStylesheets="false" extensions="Accountrecs">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlocksection >
                <apex:pageBlockSectionItem >
                 <apex:pageBlockTable value="{!accounts}" var="a">
                     <apex:column value="{!a.name}"/>
                     <apex:column value="{!a.phone}"/>
                      <apex:column value="{!a.createdDate}"/>
                    </apex:pageBlockTable> 
                </apex:pageBlockSectionItem>
            </apex:pageBlocksection>
        </apex:pageBlock>
    </apex:form>
</apex:page>


I hope this helps.

Thank you..