2015-02-09 49 views
8

我想從流星,使用SSR包和wkhtmltopdf創建pdf報告。事情進展順利,除了一件事:當我連接bootstrap 3時,我失去了所有的顏色。列格式,表格格式等都很好,但一切都是白色的黑色。即使我使用內聯CSS,我所得到的只是白底黑字。使用wkhtmltopdf與引導程序3刪除顏色樣式

如果我刪除了boostrap鏈接,所有的顏色都按預期方式通過。

下面是我渲染模板:

<Template name="spaceUtilSpacePDF"> 
    <html> 
     <head> 
      <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css"> 
      <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css"> 
     </head> 
     <body> 
      <div class="container-fluid"> 
       <div class="row"> 
        <div class="col-xs-4"> 
         <div class="well"> 
         <table class="table"> 
          <tbody> 
           <tr> 
            <td class="bg-danger"> Stuff</td> 
            <td style="background-color:blue"> Stuff</td> 
            <td style="color:red"> Stuff</td> 
           </tr> 
          </tbody> 
         </table> 
        </div> 
       </div> 
            </div> 
      </div> 
      <div style="page-break-after:always"></div> 
      <button class="btn btn-danger">Test Button</button> 

     </body> 
    </html> 

</Template> 

回答

23

這是可能是因爲the following snippet from the HTML5 Boilerplate that's included in Bootstrap v3:

/*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */ 
// ========================================================================== 
// Print styles. 

@media print { 
    *, 
    *:before, 
    *:after { 
    background: transparent !important; 
    color: #000 !important; // Black prints faster: h5bp.com/s 
    //... 
    } 

您可以從您的引導的副本中刪除這一點,或嘗試將其覆蓋。

請注意,Bootstrap v4已刪除此片段。

+0

@crush下載less/sass文件並配置自己? – 2016-02-08 14:59:57

相關問題