Custom print page size

Hello,

How to make custom size for print format? Now the standard size is A4. I want to print out document in size like A5, 1/2 A4 etc. How to do this?

Thanks

Anybody can help with some hints?

Tks

Is there simple example custom print format in Jinja where I can start with? That defines custom fixed width and height. Actually I want to print Sales Invoice in 1/3 A4 size.

Thanks a lot…

How to define fixed item-lines length? It will always show e.g. 10 lines.

If using {%- for row in doc.items -%} then it’s dynamic. I want to make it fixed: 10 lines regardless the item is 1,3, 4 so on.

What statement to use? Something like fixed array or? If the item is not null then it will show the item, else it’s just blank line.

Also how to define custom-fixed paper size e.g. 4in x 6in?

Can somebody help?

Thanks

1 Like

@Jonathan_Fanny_Lie
What page size you need to print?
Are you developer?

for custom page size add this style into your print format

<style>
    .print-format table, .print-format tr, 
    .print-format td, .print-format div, .print-format p {
        font-family: Monospace;
        line-height: 200%;
        vertical-align: middle;
    }
    @media screen {
        .print-format {
            width: 33.1in;
            padding: 0.25in;
            min-height: 46.8<style>
    .print-format table, .print-format tr, 
    .print-format td, .print-format div, .print-format p {
        font-family: Monospace;
        line-height: 200%;
        vertical-align: middle;
    }
    @media screen {
        .print-format {
            width: 33.8in;
            padding: 0.25in;
            min-height: 46.8in;
        }
    }
</style>

For more info and code please see:

2 Likes

No I am not developer but end-user with little knowledge of programming.

I want to print in 1/2 of A4 size. How to define the size?

Also, I want to put fixed item-line length (e.g. 10 lines) regardless item is 1,2,3 etc. So if item is 3, line 4th-10th is just blank lines then page-break after 10 lines (fixed). So no need to manually put page-break after certain lines.

Can you help to give template example which I can start with?

Many thanks

@Jonathan_Fanny_Lie

You need to add for condition

for i in range(1, 11):

For sample template refer this https://github.com/sbkolate/erpnext_print_format/blob/master/dealing_with_page_break/Quotation.html#L64

1 Like

I tried this but no luck, got error:

{% for i in range (1,11) %}
{% set row = doc.items[i] %}

......

{% end for %}

Could you help with some hints?

Thank you

Below works for me. Thanks

{% for i in range (1,11) %}
{% set row = doc.items[i-1] %}
{% if row != null%}
<tr>
....
</tr>
{% end if %}
{% end for %}
2 Likes
1 Like