my VF code

<apex:page controller="MyController" renderAs="pdf" applyBodyTag="false">
body { font-family: 'Arial Unicode MS'; }

    size: letter;
        content: "Dear,";
        font-family: Helvetica, Arial, sans-serif;
        font-size: 12px;
        content: "Yours Sincerely,";
        font-family: Helvetica, Arial, sans-serif;
        font-size: 10px;

body {
        font-family: Helvetica, Arial, sans-serif;
        font-size: 11px;
    <div align="right"><strong>Date</strong>: {!DAY(Today())} {!CASE(MONTH(Today()), 1, 'January', 2, 'February', 3, 'March', 4, 'April', 5, 'May', 6, 'June', 7, 'July', 8, 'August', 9, 'September', 10, 'October', 11, 'November', 12, 'December', 'Unknown')} {!YEAR(Today())}</div>
    <h1> Letter</h1>

My contoller class

public class MyController {

private final custom_object__c customobject;

    public MyController(){
        customobject = [SELECT Id, Name__c FROM custom_object__c 
                    LIMIT 1];
    public custom_object__c getcustom_object__c(){
        return customobject;
    public PageReference save() {
        update customobject;
        return null;

I got the error:

Unknown property 'MyController.custom_object__C'

How to display the field values written in between <p> </p> in my VF page?

1 Answer 1


You're using formula syntax - you need to reference the variable instead of the Object type. Salesforce knows that by {!Custom_Object__c} you mean the current record, and if you were using a standard Custom_Object__c controller, you'd already be done.

Change the merge field to {!customobject.Name__c}. This references your controller's variable, and will display data from that.

Looks like you're missing a getter or setter for your variable. Its also marked as private - no other code can view or change this variable.

public final Custom_Object__c CustomObject { get; set; }
  • Thanks. Even after changing to {!customobject.Name__c} I got the same compile error Unknown Property: Mycontroller.customobject
    – sf123
    Jul 11, 2018 at 17:00

You must log in to answer this question.

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