Saturday, 9 February 2013

Print VF page on button click

VF page Code

<apex:page controller="bhadraPieChartController" title="Pie Chart" showHeader="false">
   //this is only the code for printing the page
    function fun(){
<apex:form >
  <div  style="padding-left: 484px;padding-top: 27px;"><input type="button"   onClick="fun();" id="prnBtn"  value="Print This Page" style="background: green;"/></div>
    <apex:chart height="350" width="450" data="{!pieData}">
        <apex:pieSeries dataField="data" labelField="name"/>
        <apex:legend position="right"/>

public class bhadraPieChartController {

  public List<BhadraPieWedgeData> getPieData() {

       List<BhadraPieWedgeData> namedata = new List<BhadraPieWedgeData>();  

    namedata.add(new BhadraPieWedgeData('Jan', 30));
    namedata.add(new BhadraPieWedgeData('Feb', 15));
    namedata.add(new BhadraPieWedgeData('Mar', 10));
    namedata.add(new BhadraPieWedgeData('Apr', 20));
    namedata.add(new BhadraPieWedgeData('May', 20));
    namedata.add(new BhadraPieWedgeData('Jun', 5));
    return namedata;
    public class BhadraPieWedgeData {

        public String name { get; set; }
        public Integer data { get; set; }
        public BhadraPieWedgeData(String name1, Integer data1) {
      = name1;          
      = data1;



Print page

No comments:

Post a Comment

Getting Reference FieldsI(Lookup or Master detail) through dynamic apex

Hi , We  had a scenario If  we get a parameter "id" in the  url  then we should  be  able to find out    object reference is ...