2

I have a little issue while printing bootstrap buttons and the solutions I found aren't working. This solution didn't worked for me : stackoverflow-solution

I've also tryed to change my browser print settings to force printing background colors without success in Firefox and Chrome.

My button looks like this : enter image description here and if I print it it shows like this : enter image description here

My PHP code for that button is : echo "<button type=\"button\" class=\"btn btn-primary btn-xs\">$value</button>";

Community
  • 1
  • 1
BackTrack57
  • 395
  • 1
  • 5
  • 16

1 Answers1

1

By default, the Bootstrap CSS contains this CSS which sets a bunch of styles for printing:

@media print {
    *, :after, :before {
      color: #000!important;
      text-shadow: none!important;
      background: 0 0!important;
      -webkit-box-shadow: none!important;
      box-shadow: none!important;
    }
}

You can solve your issue by either:

  1. Fix your CSS by removing some or all of the above lines (though you only need to remove the background and colour items.)

  2. On the Bootstrap website, generate your own custom CSS with their online generator and untick the option http://getbootstrap.com/customize/.

DavidG
  • 113,891
  • 12
  • 217
  • 223
  • It's working perfectly ! I've just removed the few lines. Thank you very much for your time ! – BackTrack57 May 28 '15 at 13:32
  • Read this long winded explanation as to why this may not work: [#33410724](http://stackoverflow.com/questions/33410724/bootstrap-print-css-removes-background-color/36742058#36742058) –  Apr 20 '16 at 12:20