<style>
    .loader {
  border: 16px solid #f3f3f3; /* Light grey */
  border-top: 16px solid #3498db; /* Blue */
  border-radius: 50%;
  width: 120px;
  height: 120px;
  animation: spin 2s linear infinite;
  margin: auto; 
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.label-print-content div {
    text-align: center;
}
.label-print-content h2 {
    font-size: 23px;
    margin-bottom: 60px;
}
.label-print-content iframe{
    visibility: hidden;
}
.loader {
    margin: auto; 
}
.error-msg {
  font-size: 24px;
  color: red;
  text-align: center;
  margin-top: 100px;
  margin-bottom: 50px;
}
</style>

<?php if(isset($error_msg)): ?>
<div class="row label-print-content">
  <div class="error-msg">
    <?=$error_msg?>
  </div>
  <div class="error-btn">
    <a href="<?=$redirect_url_pass?>" class="btn btn-lg btn-danger">Ignorovat chybu a pokračovat</a>
    <a href="<?=$redirect_url_err?>" class="btn btn-lg btn-primary">Zrušit zabalení a vrátit se zpět</a>
  </div>


</div>

<?php else: ?>

  <div class="row label-print-content">
      <div class="col-md-12">
          <h2>Probíhá tisk štítku.. Prosíme o chvíli strpení.</h2>
          <a href="<?=$redirect_url_pass?>" class="btn btn-lg btn-success">Pokračovat</a>
      </div>
      
      <div class="col-md-12">
              <div class="loader"></div>
      </div>


      <div class="col-md-8 col-md-offset-2 label-iframe">
          <iframe onload="isLoaded()" id="pdf" name="pdf" src="<?=base_url("/package/load_pdf?b=".urlencode($label_url))?>"></iframe>
      </div>
  </div>



  <script>

      function isLoaded() 
      {
        var pdfFrame = window.frames["pdf"];
        pdfFrame.focus();
        pdfFrame.print();

       /*setTimeout(function() {
        document.location.href = "<?=$redirect_url_pass?>";
      }, 3000);*/
      }



  </script>
<?php endif; ?>