Print preview is completely different from the output

Hi. I have just recently switched from odoo to erpnext and have lots of questions. One is that my print output is very different from my preview.
The preview is exactly how I wanted where I have made some custom changes in the CSS. Not much but some. But when I print it on my printer the bill is really different. Like the horizontal lines are not being printed and also there are margins or paddings which I cannot remove. And also I find a lot of classes mentioned but it is not seen defined anywhere on the html part. And also vice versas. Many classes are called from different tags but the style is not seen anywhere.

This is what is looks like now. The amount is not visible completely. And the columns have been broken.

This is my code:

.nomargin { margin: 0px; padding: 0px; } .print-format table, .print-format tr, .print-format td, .print-format div, .print-format p { font-family: Caslon; line-height: 200%; vertical-align: left; } @media screen { .print-format { width: 4in; padding: 0.25in; min-height: 8in; } }

{{ company }}
{{ __("POS # : ") }} {{ offline_pos_name }}

{{ __("Customer") }}: {{ customer }}

{{ __("Date") }}: {{ dateutil.global_date_format(posting_date) }}

GSTIN No: 29AAJCR6143B1ZE


{% for item in items %} {% endfor %}
{{ __("Description") }} {{ __("Qty") }} {{ __("Rate") }} {{ __("Amount") }}
{{ item.item_name }} {{ format_number(item.qty, null,precision("difference")) }} {{ format_currency(item.rate, currency) }} {{ format_currency(item.amount, currency) }}
{% for row in taxes %} {% if not row.included_in_print_rate %} {% endif %} {% endfor %} {% if discount_amount %} {% endif %}
{{ __("Net Total") }} {{ format_currency(total, currency) }}
{{ row.description }} {{ format_currency(row.tax_amount, currency) }}
{{ __("Discount") }} {{ format_currency(discount_amount, currency) }}
{{ __("Grand Total") }} {{ format_currency(grand_total, currency) }}
{{ __("Paid Amount") }} {{ format_currency(paid_amount, currency) }}
{{ __("Qty Total") }} {{ qty_total }}

{{ terms }}

{{ __("Thank you, please visit again.") }}

1 Like

Instead of checking it with print preview check it with pdf, by generating pdf of your print.

The pdf file looks good as well. Nothing wrong with it. All goes down when I print it.

Maybe reduce the padding from 0.25 to 0.1 and see if it gives you enough space to fix the columns. Otherwise, specify a slightly smaller font so that it can fit within the 4in limit