Akshay Bajpei
Akshay Bajpei

Reputation: 196

How to set height as auto while printing a web page

I need your help.

I am making a invoice coupon system and stuck in print on coupon printer. Can you tell me how can I set the height of paper to auto, which needs to be changed dynamically as per the content.

<style type="text/css" media="print">
@page 
{
    size: auto;   /* auto is the initial value */
    margin: 0mm;  /* this affects the margin in the printer settings */
}
@media print {  
@page {  
  size:80mm 80mm;  
}  
}

Currently I am using 80mm 80mm , so width is ok but height cannot be 80 ? It should be auto adjustable.

I want to print it in rollup paper.

Please help me..

Upvotes: 3

Views: 3429

Answers (1)

Sanil
Sanil

Reputation: 126

Put the Invoice Container max-width: 80mm; for ex:

<div id="invoiceContainer">
....

</div>
<style>
#invoiceContainer{
..
max-width: 80mm;
height:auto;/*min-height:80mm;*/
}
</style>

No need of @media print queries and don't have to put size inside it.

Upvotes: 1

Related Questions