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
SYED MOOSA NAZIR T NSYED MOOSA NAZIR T N 

Visualforce RenderAs PDF not supporting SLDS CSS

Hi All,

I have a VF page built on Lightning Design system (LDS) framework. When I add the renderAs="PDF" attribute, pdf does not show the content with LDS CSS/Style.
Reference Link: https://github.com/salesforce-ux/design-system/issues/341

Note1: apex:page tag has all the usual attributes which is required for pdf (showHeader="false" sidebar="false" standardStylesheets="false" docType="html-5.0" applyHtmlTag="false" applyBodyTag="false")

Note2: Salesforce supports external stylesheet. That is, CSS file stored in Static resource. URL for example:https://developer.salesforce.com/page/Creating_Professional_PDF_Documents_with_CSS_and_Visualforce

I also copied the whole css content from the LDS CSS file (Path: 'assets/styles/salesforce-lightning-design-system-vf.min.css') and applied as inline CSS in VF page. But still, there is no luck.

My styleSheet is referred in VF page as below
apex:stylesheet value="{!URLFOR($Resource.SLDS221, 'assets/styles/salesforce-lightning-design-system-vf.min.css')}"

Page works absolutely fine if it is not rendered as PDF.
Also questioned in Stack Exchange: https://salesforce.stackexchange.com/questions/178572/visualforce-renderas-pdf-not-supporting-slds-css

Any suggestions guys??
Thanks,
Syed
Raj VakatiRaj Vakati
Hi Syed , 
Can you please incude <apex:slds /> tag and try . 

Thanks ,
Raj
SYED MOOSA NAZIR T NSYED MOOSA NAZIR T N

@Raja: Thanks for you suggestion. Unfortunately, Apex:slds doesn't go with renderAs="pdf" attribute. It means you can't use both these two features in a VF page. You will get this error An internal server error has occurred

If you want, you can test this, 

Copy the example code from the below url and add  renderAs="pdf" attribute in apex:page tag. 

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_styling_slds.htm

 

Thanks,
Syed

 

amrita h 7amrita h 7
As of now i dont think thaere is feature exist to generate Pdf from lighting component. Here is an idea posted for the same. please upvote and help to get it done in the next releases.

https://success.salesforce.com/ideaView?id=0873A000000U3GIQA0