Script report print orientation landscape

Hello @kolate_sambhaji

I have notice you have solve the problem in custom page size and orientation. Our paper is 13inch x 8.5 inch I want to have it in landscape so width is 13inch and 8.5 height. I tried to copy your code and change the width and min-height this is how it looks like

<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: 13in;
            padding: 0.25in;
            min-height: 8.5<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: 13in;
            padding: 0.25in;
            min-height: 8.5in;
        }
    }
</style>
<h2 class="text-center">{%= __("Subject Grading Report") %}</h2>
<hr>
<table class="table table-bordered">
	<thead>
		<tr>
		{% for(var i=0, l=report.columns.length; i<l; i++) { %}
			<th class="text-right">{%= report.columns[i].label %}</th>
		{% } %}
		</tr>
	</thead>
</table>

but I still get this preview

the font was change but the orientation still in portrait. Any idea how to make this landscape? Thanks in advance

1 Like

Hello @rmehta, sorry for bothering you. I have notice all the reports in ERPNext is in portrait preview/print. Is landscape not yet implemented?

ok I have solve this by specifying max-width and min-height. see code below

<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 {
            max-width: 13in;
            padding: 0.25in;
            min-height: 8.5in;
        }
    }
</style>

<h2 class="text-center">{%= __("Subject Grading Report") %}</h2>
<hr>
<table class="table table-bordered">
    <thead>
    <tr>
        {% for(var i=0, l=report.columns.length; i<l; i++) { %}
             <th class="text-right">{%= report.columns[i].label %}</th>
        {% } %}
    </tr>
    </thead>
</table>
6 Likes