Custom layout and page size for printing

Hello! I just created a custom Sales Invoice Template. On printing, i get the Aw, Snap! error in chrome. On generating PDF, my layout gets jumbled.

Here is the code and a preview of the layout:


.print-format table, .print-format tr, .print-format td, .print-format div, .print-format p { font-family: Monospace; line-height: 150%; vertical-align: middle; } @media screen { .print-format { width: 8.5in; padding: 0.25in; min-height: 6.49in; } p.row { margin-top: 50px; } }

{{ doc.customer_name }}
{{ doc.get_formatted("posting_date") }}

Sales Person:
{{ doc.sales_partner}}
{{ doc.name }}




{%- for row in doc.items -%}
		<td style="width: 15%; text-align: right;">{{
			row.get_formatted("rate", doc) }}</td>
		<td style="width: 15%; text-align: right;">{{
			row.get_formatted("amount", doc) }}</td>
	</tr>
	{%- endfor -%}
{{ row.qty }} {{ row.uom or row.stock_uom }} {{ row.item_code}}
{{row.item_name}}
{{ row.description }}
 <tr class="row">
     <div class="col-md-12 text-right">
             <b>{{ doc.get_formatted("grand_total") }}</b>
     </div>
 <br>

 <tr class="row">
     <td></td>
     <div class="col-md-4 text-right">
             <b>{{ doc.get_formatted("grand_total") }}</b>
     </div>

     {% if doc.get("taxes", filters={"included_in_print_rate": 1}) %}
     {%- for row in doc.taxes -%}
     {%- if row.included_in_print_rate -%}

      <div class="col-md-8 text-right">
             <b>{{ row.get_formatted("tax_amount_after_discount_amount", doc) }}
             </b>
      </div>
      <br>

      <div class="col-md-4 text-right">
             <b>0.00</b>
      </div>
      
      <div class="col-md-8 text-right">
             <b>{{ doc.get_formatted("net_total") }}</b>
      </div>
      <br>

      <div class="col-md-4 text-right">
             <b>0.00</b>
      </div>
      
      <div class="col-md-8 text-right">
             <b>0.00</b>
      </div>
      <br>

      <div class="col-md-4 text-right">
             <b>{{ doc.get_formatted("net_total") }}</b>
      </div>
      
      <div class="col-md-8 text-right">
             <b>{{ doc.get_formatted("grand_total") }}</b>
      </div>
      <br>

      <div class="col-md-12 text-right">
             <b>{{ row.get_formatted("tax_amount_after_discount_amount", doc) }}
             </b>
      </div>
      <br>

      <div class="col-md-12 text-right">
             <b>{{ doc.get_formatted("grand_total") }}</b>
      </div>
</tr> 
{%- endif -%}
{%- endfor -%}
{%- endif -%}