+ Start a Discussion

CSS style not being applied for renderAs="pdf"

Baffling, I don't think I am doing anything wrong since I've created PDFs like this before.  Based on the code below, the div should pick up the style.  Not the case.


<apex:page renderAs="pdf">
      #message {
        color: red;

  <div id="message">Should display in red</div>


I have other PDF pages that render out correctly.  I copied that code over to this new VF page.  Same issue as stated.  I've tried with recreated a new VF page. No success.  I am stumped.  Any help is appreciated.

OK. Looks like a version issue. I changed the Apex version to 26.0 on the page and looks like it displays correctly now. It had been set to version 27.0 (new in Spring ’13 release). Not sure what’s up with that.
Prafull G.Prafull G.

Seems like you figured out and resolved the issue by fixing version number. However, if you want to use the latest version i.e. 27.0 then You do not need to specify <html> tags explictly on your page.


Try removing the <html> tag from your code and check. It should work.



Shiv ShankarShiv Shankar

Try this one.

<apex:page renderAs="pdf" standardStyleSheet = "false">