2

Following is my code which is working fine as a VF page on preview, but no styling adding on rendering as PDF renderAs="PDF". Let me know what I am doing wrong as I am new to the platform.

Code -

<apex:page>
  <!-- Adding CSS -->
  <!-- <apex:stylesheet value="{!URLFOR($Resource.SLDS092, 'assets/styles/salesforce-lightning-design-system-vf.css')}" /> -->

<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" />

<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css" />

<div class="container">
<div class="row">
  <div class="col-md-6">.col-md-6</div>
  <div class="col-md-6">.col-md-6</div>
</div>
<div class="row">
  <div class="col-md-8">.col-md-8</div>
  <div class="col-md-4">.col-md-4</div>
</div>
<div class="row">
  <div class="col-md-4">.col-md-4</div>
  <div class="col-md-4">.col-md-4</div>
  <div class="col-md-4">.col-md-4</div>
</div>
<div class="row">
  <div class="col-md-6">.col-md-6</div>
  <div class="col-md-6">.col-md-6</div>
</div>
</div>
</apex:page>
6
  • try to include your Bootstrap file in static resource and then reference them . Commented Oct 16, 2015 at 6:35
  • @TusharSharma I added bootstrap bootstrap-3.3.5-dist.zip as a static resource and using like - <apex:stylesheet value="{!URLFOR($Resource.bootstrap, 'bootstrap-3.3.5/css/bootstrap.min.css')}" /> <apex:stylesheet value="{!URLFOR($Resource.bootstrap, 'bootstrap-3.3.5/css/bootstrap-theme.min.css')}" /> but stylesheet is not coming
    – Nesh
    Commented Oct 16, 2015 at 7:09
  • @TusharSharma bootstrap is the name of my static folder
    – Nesh
    Commented Oct 16, 2015 at 7:09
  • 1
    When you remove render as pdf then bootstrap is available. Also keep in mind that there many css which will not work with renderAs=pdf Commented Oct 16, 2015 at 7:12
  • @TusharSharma I am not rendering it in PDF I am only testing as VF first like - pastebin.com/v1F0SvtX
    – Nesh
    Commented Oct 16, 2015 at 7:15

1 Answer 1

4

You're not going to be able to render PDFs properly that were created with Bootstrap. The Flying Saucer Render engine used by Salesforce only supports CSS 2.1 and HTML 4.1

4
  • 2
    To add to this, spurdoc.com will work with bootstrap and create a PDF for you. Only downside is you have to expose the VF page to a public site and maybe create a urlparam key to ensure the page will not display without it to protect the contents (somewhat)
    – Eric
    Commented Oct 16, 2015 at 15:38
  • Who knows, perhaps the spurdoc.com engine will be what Salesforce winds up finding a way to support in some manner as a means of enabling PDF support for HTML5 and Lightning pages. Will be interesting to see what kind of support for PDFs they eventually come up with.
    – crmprogdev
    Commented Oct 16, 2015 at 15:43
  • @crmprogdev Wow thanks for the info ..it really consumed my whole day with hit and trial ..just out of curiosity even newly SLDS also not supported if I replace it with bootstrap ?
    – Nesh
    Commented Oct 19, 2015 at 3:55
  • That's correct. No support for PDFs with Lightning. You'll find it in the release notes here under "working with data".
    – crmprogdev
    Commented Oct 19, 2015 at 20:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .