0

I have a thermal receipt printer. I am using javascript to print a div it's printing everything correctly apart from that it keeps printing whole roll(blank) after printing data in the start. I think the problem is in the CSS but I can't figure it out. Here is what I have got so far.

@media print {
html, body {
    border: 1px solid white;
    height: auto !important;
    page-break-after: always !important;
    page-break-before: always !important;
 }

.paper-size {
    width: 76mm !important;
}}
Rafael
  • 7,605
  • 13
  • 31
  • 46
tayyab_fareed
  • 559
  • 9
  • 15
  • try saving print page to a pdf file and see if breaks are working, i think the height of the page is too high and that is why it prints blank pages – MakeLoveNotWar Oct 24 '18 at 19:00
  • At a *guess*, perhaps setting a sensible `max-height` for the paper size would limit how much paper it can waste. – Andrew Morton Oct 24 '18 at 19:00
  • Some of the solutions here might be of assistance. https://stackoverflow.com/questions/7846346/how-to-avoid-extra-blank-page-at-end-while-printing/7847290 – rawnewdlz Oct 24 '18 at 19:02
  • @MancharyManchaary pdf has only single page + 1 blank page but problem is that printer keeps rolling endlessly – tayyab_fareed Oct 24 '18 at 19:42
  • 1
    i guess receipt printers page size is way smaller than the classic A4 page also try this property `page-break-after: auto;` instead of auto – MakeLoveNotWar Oct 24 '18 at 19:44

0 Answers0