Does anyone have insight into the best practice to style a Visualforce page to match the SLDS for inclusion in a lightning component and printing?
I can hear the choirfolk chanting: Visualforce is so stale! To which I say: Unless you want to actually print your work. (It would be amazing if lightning could print in a useful way.)
I'm working on a Visualforce page that will be included included in a lightning component that will also be used for a printed version of the VF page contents renderd as pdf.
To prevent recommendations to use the SLDS in Visualforce, it seems this is a dead end.
I've personally tried every permutation of apex:slds
, lightningStylesheets="true"
, applyHtmlTag="false"
, applyBodyTag="false"
, renderAs="pdf"
, and renderAs="advanced_pdf"
.
I appears that any attempt to render Visualforce that includes the SLDS CSS causes Salesforce to puke with
An internal server error has occurred.
I'm not the first to discover this behavior.
I haven't tried embedding the LDS CSS in a static resource because it appears this didn't work for others.
As @Ronnie pointed out, it seems using the SLDS CSS itself will not work because the pdf rendering engine Salesforce uses doesn't support modern CSS.
Which leave me asking: Can you recommend a best practice for styling a Visualforce page to conform with the SLDS without actually including the SLDS?