0

Following is the error I am getting on using bootstrap for PDF file generation.

External URL = https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/fonts/glyphicons-halflings-regular.eot is not accessible unless whitelisted (appserverPath = http://ap2.salesforce.com, request URL = http://my-instance.force.com/apex/PDFDemo)

I changed relative font path with a CDN link as suggested HERE, but still getting the same error.

Change made in bootstrap -

From-

src: url('../fonts/glyphicons-halflings-regular.eot');

To -

src: url('https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/fonts/glyphicons-halflings-regular.eot');

Following is my code -

<apex:page  docType="html-5.0" renderAs="PDF">
  <!-- Adding CSS -->
  <!-- <apex:stylesheet value="{!URLFOR($Resource.SLDS092, 'assets/styles/salesforce-lightning-design-system-vf.css')}" /> -->
        <apex:stylesheet value="{!URLFOR($Resource.bootstrap, 'bootstrap-3.3.5/css/bootstrap.css')}" />
        <apex:stylesheet value="{!URLFOR($Resource.bootstrap, 'bootstrap-3.3.5/css/bootstrap-theme.min.css')}" />

<div class="container">
    <div class="row">
      <div class="col-md-6">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</div>
      <div class="col-md-6">
          <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
          <p>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>
      </div>
    </div>
</div>
</apex:page>
2

I'm pretty new to Salesforce so there's a good possibility that I got this wrong (i would add this as a comment instead of an answer if I had enough rep to do that).

Basically, what comes to my mind is that you need to add the Request URL to "Remote Sites".

Check this out - https://help.salesforce.com/apex/HTViewHelpDoc?id=configuring_remoteproxy.htm&language=en

  • I remove the font from glyphicons-halflings-regular.eot to Arial in bootstrap now the error is - PDF generation failed. Check the page markup is valid. pastebin.com/uf3UmjTd – Nesh Oct 16 '15 at 10:00
  • Go to the link below and check the last comment about the large CSS files: developer.salesforce.com/forums/?id=906F0000000AaVAIA0 – smukov Oct 16 '15 at 10:37
  • you are right I shorten the bootstrap file to around 600 and its working...pretty useless :( – Nesh Oct 16 '15 at 12:39
  • Wonder if it's possible to divide that one large css into multiple short ones and include them one by one? Maybe then everything will work as expected. – smukov Oct 16 '15 at 12:54
  • I dont think its working as if I am using it as VF, then bootstrap classes applied but in PDF not working :( This is the css file I am using pastebin.com/ctesBTGc and this is the code pastebin.com/20Gkcy1q – Nesh Oct 16 '15 at 13:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.