title: Why is my print preview blank using window.print?
body: <p>Hi im trying to print my view and its data using window.print but when i click on my print button the preview is blank instead of showing my datatable and all its content. I just get a blank page with my title and the localhost url</p>
  <p>This is my simple js function:</p>
  <pre><code>&lt;script&gt;
    function ImprimirPagina(){
      window.print('');
    }
  &lt;/script&gt;
  </code></pre>
  <p>And this is my blade view:</p>
  <pre><code>&lt;div class=&quot;container-fluid&quot;&gt;
          &lt;!-- Main row --&gt;
          &lt;div class=&quot;row&quot;&gt;
              &lt;!-- Left col --&gt;
              &lt;section class=&quot;col-md-12&quot;&gt;
                  &lt;!-- Custom tabs (Charts with tabs)--&gt;
                  &lt;div class=&quot;card&quot; style=&quot;background-image: linear-gradient(200deg, #070525ce 1%, rgb(1, 0, 5)100%);&quot;&gt;
                      &lt;div class=&quot;card-header&quot;&gt;
                          &lt;h3 class=&quot;font-weight-light text-white&quot;&gt;Productos
                              &lt;a class=&quot;btn bg-white float-right btn-sm&quot; href=&quot;{{ route('products.add') }}&quot;&gt;&lt;i
                                      class=&quot;fa fa-plus-circle&quot;&gt;&lt;/i&gt; Agregar Producto&lt;/a&gt;
                          &lt;/h3&gt;
                      &lt;/div&gt;
  
                      
                  &lt;/div&gt;&lt;!-- /.card-header --&gt;
                  &lt;div&gt;
                      
                      
                  &lt;/div&gt;
                  &lt;div class=&quot;card-body&quot;&gt;
                      &lt;table id=&quot;example1&quot; class=&quot;table table-striped table-responsive&quot; width=&quot;100%&quot;&gt;
                          &lt;thead class=&quot;thead&quot;&gt;
  
                              
  
                              &lt;tr&gt;
                                  &lt;th style=&quot;display: none&quot;&gt;Codigo&lt;/th&gt;
                                  &lt;th&gt;ID&lt;/th&gt;
                                  &lt;th&gt;Producto&lt;/th&gt;
                                  &lt;th&gt;Tipo de Producto&lt;/th&gt;
                                  &lt;th&gt;Marca&lt;/th&gt;
                                  &lt;th&gt;Modelo&lt;/th&gt;
                                  &lt;th&gt;Moneda de Compra&lt;/th&gt;                                                                       
                                  &lt;th&gt;Costo Fob&lt;/th&gt;
                                  &lt;th&gt;Moneda de Venta&lt;/th&gt;
                                  &lt;th&gt;Precio de Lista&lt;/th&gt;
                                  &lt;th&gt;Margen Bruto&lt;/th&gt;
                                  
                                  &lt;th style=&quot;width: 12%&quot;&gt;Accion&lt;/th&gt;
                              &lt;/tr&gt;
                          &lt;/thead&gt;
                          &lt;tbody&gt;
                             
                              @foreach($file as $key =&gt; $product)
                              @if($product-&gt;status == 1)
                                  &lt;tr&gt;
                                      &lt;td style=&quot;display: none&quot;&gt;{{ $key+1 }}&lt;/td&gt;
                                      &lt;td&gt;{{ $product-&gt;id }}&lt;/td&gt;
                                      &lt;td&gt;{{$product-&gt;marca-&gt;brandName . &quot; &quot; . $product-&gt;modelo-&gt;modelName}}&lt;/td&gt;
                                      &lt;td&gt;{{ $product['ptype']['productType']}}&lt;/td&gt;
                                      &lt;td&gt;{{ $product-&gt;marca-&gt;brandName }}&lt;/td&gt;
                                      &lt;td&gt;{{ $product-&gt;modelo-&gt;modelName}}&lt;/td&gt;
                                      &lt;td&gt;{{ $product-&gt;coin }}&lt;/td&gt;                                    
                                      &lt;td&gt;{{ $product-&gt;costUSD }}&lt;/td&gt;
                                      &lt;td&gt;{{$product-&gt;sale_coin}}&lt;/td&gt;
                                      &lt;td&gt;{{$product-&gt;list_priceUSD}}&lt;/td&gt;
                                      &lt;td&gt;{{$product-&gt;marginUSD}}&lt;/td&gt;
                                      
                                      @php
                                      $count_product = App\Model\Purchase::where('product_id',$product-&gt;id)-&gt;count();
                                      @endphp
                                          &lt;td&gt;
  
  
                                          &lt;!--&lt;a title=&quot;Download&quot; id=&quot;download&quot; class=&quot;btn btn-sm btn-success&quot;
                                              href=&quot;/products/download/{{ $product-&gt;file }}&quot;&gt;&lt;i
                                                  class=&quot;fa fa-download&quot;&gt;&lt;/i&gt;&lt;/a&gt;--&gt;
                                          &lt;a title=&quot;Edit&quot; class=&quot;btn btn-sm text-white&quot;
                                              style=&quot;background-image: linear-gradient(200deg, #070525ce 1%, rgb(1, 0, 5)100%);&quot;
                                              href=&quot;{{ route('products.edit', $product-&gt;id) }}&quot;&gt;&lt;i
                                                  class=&quot;fa fa-edit&quot;&gt;&lt;/i&gt;&lt;/a&gt;
                                          &lt;a title=&quot;Delete&quot; id=&quot;delete&quot; class=&quot;btn btn-sm btn-danger&quot;
                                              href=&quot;{{ route('products.delete', $product-&gt;id) }}&quot;&gt;&lt;i
                                                  class=&quot;fa fa-trash&quot;&gt;&lt;/i&gt;&lt;/a&gt;
                                          &lt;a title=&quot;Info&quot; id=&quot;info&quot; class=&quot;btn btn-sm btn-info&quot; href=&quot;{{route('products.detail', $product-&gt;id)}}&quot; &gt;&lt;i class=&quot;fa fa-eye&quot; &gt;&lt;/i&gt;&lt;/a&gt;
                                          
                                      &lt;/td&gt;
                                  &lt;/tr&gt;
                              @endif
  
                                  
                              @endforeach
                          &lt;/tbody&gt;
                          
                      &lt;/table&gt;
                  &lt;/div&gt;&lt;!-- /.card-body --&gt;
  
                  &lt;button onclick=&quot;ImprimirPagina();&quot; class=&quot;btn btn-success&quot;&gt;&lt;i class=&quot;fas fa-print&quot;&gt;&lt;/i&gt;&lt;/button&gt;
                  
          &lt;/div&gt;
  </code></pre>
  <p>This is the print button:</p>
  <pre><code>&lt;button onclick=&quot;ImprimirPagina();&quot; class=&quot;btn btn-success&quot;&gt;&lt;i class=&quot;fas fa-print&quot;&gt;&lt;/i&gt;&lt;/button&gt;
  </code></pre>
  <p>And this is what my print preview looks like:</p>
  <p><a href="https://i.stack.imgur.com/Hyd9L.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Hyd9L.png" alt="enter image description here" /></a></p>