0

I am making a project where I have to use a progress bar, and in the end I have to print that page simply. But the problem is whenever I print/ or save as pdf, the page using ctrl+p command progress bar becomes invisible on the printed/PDF document.

I am using very simple example, which is available on w3schools.com. and I am providing the code as well

<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container">
  <h2 style="color:red">Colored Progress Bars</h2>

  <!-- Blue -->
  <div class="progress">
    <div class="progress-bar" style="width:10%"></div>
  </div><br>

  <!-- Green -->
  <div class="progress">
    <div class="progress-bar bg-success" style="width:20%"></div>
  </div><br>  
</div>

</body>
</html>
raj
  • 21
  • 1
  • 1
  • 7

1 Answers1

2

I hope it helps you:

@media print {
.progress {
    position: relative;
}
.progress:before {
    display: block;
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 0;
    border-bottom: 2rem solid #eeeeee;
}
.progress-bar {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1;
    border-bottom: 2rem solid #337ab7;
}
.bg-success {
    border-bottom-color: #67c600;
}
.bg-info {
    border-bottom-color: #5bc0de;
}
.bg-warning {
    border-bottom-color: #f0a839;
}
.bg-danger {
    border-bottom-color: #ee2f31;
}
}

my reference > Bootstrap - progress-bar is not shown in print preview

MaatheusGois
  • 139
  • 5