0

I am trying to generate the pdf page and send an email , I have taken a variable in apex and displaying into the vf page unfortunately its not printing on page when sending an email , let me know any ideas.

Apex:

public string fid {set;get;}

VisualForce:

<apex:page standardController="obj" showHeader="false" standardStylesheets="false" renderAs="pdf">
   {!fid} 
</apex:page>

Result:

Variable is not printing in pdf page.

7
  • Provide the functionality you are using that is proving a failure.
    – TSmith
    Dec 2, 2016 at 12:08
  • apex: public string fid {set;get;} vf: <apex:page standardController="obj" showHeader="false" standardStylesheets="false" renderAs="pdf">{!fid} </apex:page> variable is not printing in pdf page
    – raja
    Dec 2, 2016 at 12:10
  • maybe this can help blog.jeffdouglas.com/2010/07/16/…
    – unidha
    Dec 2, 2016 at 12:11
  • Do you ever set a value to your variable? Dec 2, 2016 at 12:21
  • i can help you. But i need more information. You can use outputText tag. Your variable have some value???? please put your code for example retrieve somo value of the object. You should not have any problem to render this data as pdf. Pdf render have somo limitation check the saleforce documentation.
    – Miren
    Dec 2, 2016 at 12:32

1 Answer 1

1

The reason this could be happening is that your VF page doesn't reference the controller extension class

You have:

<apex:page standardController="obj" showHeader="false" standardStylesheets="false" renderAs="pdf">
 {!fid} 
</apex:page>

You need:

<apex:page standardController="obj" showHeader="false"
    extensions="MyController"
    standardStylesheets="false" renderAs="pdf">
 {!fid} 
</apex:page>

I'm surprised the page even compiled.

If, on the other hand, this was a typo in your OP, then unless fld is populated by the extension class's constructor, when the page is rendered, the getter for fld will return null. If you don;t want the constructor to do the population, then the getter itself has to do logic to populate itself.

You must log in to answer this question.

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