function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sachin Tiwari 54Sachin Tiwari 54 

Internal stylesheet via apex with render as pdf

Hi All,
I have a situtation, i want to render a vf page whcih is consisiting of few components , these component have dedicated controller by whom i am applying some stylesheet using apex class of these conponents. The issue is when i am trying to render them as pdf then the stylesheet is not working only inline style sheet is working. But when i removed render as pdf then everything is good w.r.t stylesheet.

Any help would be appreciated! PLz suggest what can i do to achieve the desired result.
SScholtzSScholtz
When you say "applying some stylesheet using apex class", what do you mean, how are you bringing in the style sheet?

A standard way to have an external style sheet, not inline styles, is to have a static resource and include the sheet in your VF page like this:

<apex:stylesheet value="{!URLFOR($Resource.your_static_resource_css_file)}"/>

Having said that, CSS support in Salesforce's PDF engine has always been a bit wonky and doesn't work the way you expect it to.