How to print a Visualforce page in Salesforce?

Sample Code:

Visualforce page:

<apex:page showHeader="false" controller="Sample" >
    <apex:panelGrid width="100%" style="text-align:right;">
        <apex:form >
            <apex:commandLink value="Print" onclick="window.print();"/>
    <apex:pageBlock title="Member Information">
        <apex:pageBlockTable value="{!MemberList}" var="m">
            <apex:column value="{!m.Name}"/>
            <apex:column value="{!m.City__c}"/>
            <apex:column value="{!m.Country__c}"/>

Apex Controller:

public class Sample {

    public List<Member__c> memberList {get;set;}
    public Sample() {
        memberList = new List<Member__c>();
        memberList = [SELECT Name, City__c, Country__c FROM Member__c];



No comments:

Post a Comment

Sharing is Caring!!! Share this with your friends!!!

submit to reddit