Link to home
Start Free TrialLog in
Avatar of randy672
randy672

asked on

Salesforce when rendering as PDF CSS styling is ignored

when rendering as PDF CSS styling is ignored in Salesforce


When I render a PDF page it seems to ignore any CSS styling.  Does anyone have a work around for this?
Avatar of level9wizard
level9wizard
Flag of Canada image

How are you trying to render the page as PDF? I.e. are you trying to click "File>Print>Save to PDF" in your web browser?

The consistency between HTML+CSS to PDF (styled by the same CSS) is lacking. There simply isn't great standards support for CSS in PDF as there is in the web/HTML.
Avatar of techhealth
Are you using <apex:stylesheet> to include your CSS?
ASKER CERTIFIED SOLUTION
Avatar of acrozier
acrozier

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
For your visualforce page, you will have to use apex, not css or html to get it to display correctly. You can simply add the css and html into the visualforce apex formulator, but it won't display as you want without writing it in apex using the correct classes
Avatar of randy672
randy672

ASKER

I've requested that this question be deleted for the following reason:

solution was not provided
We use <apex:stylesheet value="{!$Resource.PrintPdf}"/> with any VF that has renderas="PDF" on.  That helps to maintain standard look and feel across pages.

Putting
<style type="text/css">
in VF directly also works for us, if there's a need for special styling.

Is there a specific element that didn't work for you?