I'm trying to display a page rendering as PDF with the information that I have in a custom object, I'm getting this error

"Unknown constructor 'PdfRenderController.PdfRenderController(ApexPages.StandardController controller)"

Could please someone help-me with my code?


<apex:page standardController="Reservas__c" renderAs="pdf" applyBodyTag="false" extensions="PdfRenderController">
            body { font-family: 'Arial Unicode MS'; }
            .companyName { font: bold 30px; color: red; }  
        <h1>New Account Name!</h1>
        <apex:panelGrid columns="1" width="100%">
            <apex:outputText value="{!Reservas__c}" styleClass="companyName"/>
            <apex:outputText value="{!NOW()}"></apex:outputText>

My controller:

public with sharing class PdfRenderController {
    public PdfRenderController (ApexPages.StandardController sc)  {
        public Reservas__c realizadas   {get; private set;}
        realizadas = [SELECT Id, Name FROM Reservas__c]; 

1 Answer 1


I would not expect the class as posted to compile. Exchanging line 2 and 3 should make it compile. It will then be available to use in the page without the error message your mention.

However, if there is not exactly 1 row returned in the query it will break at runtime. Hard to know what you are aiming to do, but e.g. this will not break at runtime:

public with sharing class PdfRenderController {
    public Reservas__c[] realizadas {get; private set;}
    public PdfRenderController (ApexPages.StandardController sc)  {
        realizadas = [SELECT Id, Name FROM Reservas__c LIMIT 100]; 

If you are only displaying fields from one object than you can use the values automatically queried (when mentioned in the Visualforce) by the standard controller e.g.:

<apex:outputText value="{!Reservas__c.Name}" styleClass="companyName"/>

without adding your own query in the extension (or an extension at all).

  • Keith, thank you! The error does not appears anymore... but in the PDF page that is generate, does not return any value with {!Reservas__c.Name} (or Id). Have any ideia why? Apr 1, 2016 at 14:34

You must log in to answer this question.

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