This is vf pdf

<apex:page standardController="Opportunity"  extensions=" EstimatedCostsheetCtrl" renderas="pdf" showheader="true" sidebar="false">
            <apex:form style="border: 2px solid;text-align: left;padding: 4px;"> 
                <div align="right" style=" font: bold 21px; color:#2E86C1">
                    <b><apex:outputText value="{0,date,d MMM yyyy}">
                        Date: <apex:param value="{!today()}"/>
                        </apex:outputText></b> </div>
                    <apex:panelGrid columns="1" width="40%">
                        <img src="{!$Resource.roshanlogo1}" width="80%" height="70%" align="top-right"/>
                        <u><center><b><h2 style="color:#2E86C1;font-family:arial;font-size:30px;">Estimated Cost Sheet</h2></b></center></u>
                 <table style="font-family: arial, sans-serif;border-collapse: collapse;height: 50%;width:100%;">
                       <td style="border: 2px solid #dddddd;text-align: left;padding: 4px; background-color:#F5B041;">Project Name</td> 
                       <td style="border: 2px solid #dddddd;text-align: left;padding: 4px; background-color:#F5B041;"></td> 
                       <td style="border: 2px solid #dddddd;text-align: left;padding: 4px;">Building Name</td>
                        <td style="border: 2px solid #dddddd;text-align: left;padding: 4px;"></td>

This is apex controller

public class EstimatedCostsheetCtrl {
    public String recordId {get; set;}
    public Opportunity o {get; set;}
    public EstimatedCostsheetCtrl(ApexPages.StandardController controller){
        Id recordId = ApexPages.currentPage().getParameters().get('id');
        this.o = [SELECT Name, Id, Apartment__c, Apartment__r.Name, Project_Name__c, Wing__c, Floor__c, Super_Build_Up_Area_Sqft__c, Type__c, Basic_Rate_Sqft__c, Apartment__r.Infrastructure_Charges__c, Stamp_Duty_Amount__c, Registration_Amount__c, Total_Cost__c,Government_Tax_Amount__c
                 FROM Opportunity where Id = :recordId];

This is the iframe

<apex:page Controller="EstimatedCostsheetCtrl" lightningStylesheets="true">
        <apex:form >
            <apex:pageBlock >  
            <apex:iframe scrolling="true" height="800px" id="Page" src="/apex/EstimatedCostsheetPdf?id={!o.Id}" width="100%" ></apex:iframe>
            <apex:commandButton styleClass=" slds-button_brand slds-button" style="height: 35px;margin-top: 10px; margin-left: 47%; background: rgba(37, 102, 94, 1);color: white;" action="{!savePdf}" value="Save EstimateCostsheet "/>
            <apex:pageMessages />

1 Answer 1


<apex:page standardController="SomeType" extensions="SomeClass"> expects a constructor with SomeClass(ApexPages.StandardController param), while <apex:page controller="SomeClass"> expects a constructor of SomeClass(). In Apex, you get a "free" zero-argument public constructor unless you define another constructor, in which case this constructor is no longer available. As such, to use both pages, you need both a zero argument and one argument constrcutor:

public class SomeClass {
  public SomeClass() { 
    // Zero argument constructor
  public SomeClass(ApexPages.StandardController controller) {
    // One argument constructor

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .