1

I have a table which may have many rows. I want to print it without split each row.

I use page-break-after, page-break-before, page-break-inside to achieve this. However, there will always be some part of next page printed on current page. See my screenshot, the content in the blue box should all print on next page.

My css is :

.table_parent {
  page-break-before:auto;
  page-break-after:auto;
  page-break-inside:avoid;
  position:relative;
}

.table_self tr{
  page-break-before:auto;
  page-break-after:auto;
  page-break-inside:avoid;
  position:relative;
}

Can anybody help ? Thanks very much.

click to see my print screenshot

Arrow Xu
  • 11
  • 2
  • 1
    What exactly are `table_parent` and `table_self`? Can you post the HTML, or even better a full working example? – RoToRa Jan 24 '17 at 08:32
  • It's hard to tell what is going on the code. Please post your code? – Yonas Hailu Jan 24 '17 at 08:58
  • I think this might help you? [Printing HTML table with many columns/rows using CSS layout?](http://stackoverflow.com/questions/26777317/printing-html-table-with-many-columns-rows-using-css-layout) – Yonas Hailu Jan 24 '17 at 09:02
  • Sorry, but I (and I guess many others) won't download an unknown zip file. Please post a **minimal** example (leaving anything irrelevant out). See http://stackoverflow.com/help/mcve – RoToRa Jan 24 '17 at 09:24
  • @RoToRa thanks any way. The problem is that I can't find a minimal example of this issue. And I think if I can find the minimal reproduce example, the problem in my example should be solved. Thanks again for your reply and time. – Arrow Xu Jan 24 '17 at 09:34

2 Answers2

0

Have you tried changing the paper size in 'More settings -> paper size' (printing option).

Tharusha
  • 635
  • 8
  • 25
  • Yes, I tried all the options in the list (A3, A4, A5 and others), all displayed as my screenshot. I think it may have something to do with the css style, but I don't how to fix that. – Arrow Xu Jan 24 '17 at 08:52
0

At last, I got the reason. It's because in the top level div, I define the top as -20px by fault. This will effect each page when print them. So we can see that every page of my screenshot have a -20px offset.

Thanks for all your help.

Arrow Xu
  • 11
  • 2