Can wkhtmltopdf avoid page-break-inside of TBODY tag?

4,985 views
Skip to first unread message

บอล ลูน

unread,
Jun 11, 2014, 6:09:50 AM6/11/14
to wkhtmltop...@googlegroups.com
Hello,

I'm a newbie of wkhtmltopdf , I want the TR between <TBODY></TBODY> always show in the same page.
Here is my html

<table>
<tbody>
<tr><td>col1 row1</td></tr>
<tr><td>col1 row2</td></tr>
<tr><td>col1 row3</td></tr>
</tbody>

.. Repeat TBODY for 100 Times ...

</table>

I try to set css  TBODY { page-break-inside:always; }
but it still split my TBODYs.

Can you please advice me on this.

Sorry for my bad grammar

Regards,
Nattapong

Chris Tate-Davies

unread,
Jun 11, 2014, 6:37:59 AM6/11/14
to wkhtmltop...@googlegroups.com
Don't you want 

page-break-inside: avoid;

?


--
===================================================
You received this message because you are subscribed to the "wkhtmltopdf General" group.
To post to this group, send email to wkhtmltop...@googlegroups.com
To unsubscribe from this group, send email to wkhtmltopdf-gen...@googlegroups.com
 
For more options, visit this group at
http://groups.google.com/group/wkhtmltopdf-general?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups "wkhtmltopdf General" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wkhtmltopdf-gen...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

บอล ลูน

unread,
Jun 11, 2014, 6:54:46 AM6/11/14
to wkhtmltop...@googlegroups.com
Oh ,sorry my first post is wrong
---------------

Yes, here is my css

TBODY {
 style=" page-break-inside: avoid !important;"
}

It not change my output


More info 
wk version 0.12.1


เมื่อ วันพุธที่ 11 มิถุนายน ค.ศ. 2014, 17 นาฬิกา 37 นาที 59 วินาที UTC+7, Chris Tate-Davies เขียนว่า:
To unsubscribe from this group, send email to wkhtmltopdf-general+unsub...@googlegroups.com

 
For more options, visit this group at
http://groups.google.com/group/wkhtmltopdf-general?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups "wkhtmltopdf General" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wkhtmltopdf-general+unsub...@googlegroups.com.

Chris Tate-Davies

unread,
Jun 11, 2014, 7:25:56 AM6/11/14
to wkhtmltop...@googlegroups.com
Have you managed to get this to work on a normal print preview? I.e. not using wkhtmltopdf?

I just created a simple page with a large table with your CSS, and mine are split. So obviously not a problem with wkhtmltopdf, but a problem with your CSS/HTML

I suggest getting it working in a normal print preview first


To unsubscribe from this group, send email to wkhtmltopdf-gen...@googlegroups.com

 
For more options, visit this group at
http://groups.google.com/group/wkhtmltopdf-general?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups "wkhtmltopdf General" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wkhtmltopdf-gen...@googlegroups.com.

NATTAPONG

unread,
Jun 11, 2014, 2:56:52 PM6/11/14
to wkhtmltop...@googlegroups.com
I think my css is correct because IE11 show me the result that I want.
but Chrome and wkhtmltopdf are incorrect

Please see these files

My simple table code http://cloudnii.com/test.html.txt

IE11 print preview  http://cloudnii.com/PDF_IE_Preview_correct.gif   Correct (Item's detail row group in the same page)

Chorme print preview http://cloudnii.com/PDF_Chrome_Preview_incorrect.gif  Incorrect

Wkhtmltopdf output http://cloudnii.com/PDF_incorrect_page_break.gif Incorrect

Wkhtmltopdf output file http://cloudnii.com/test.pdf

Can you run my html code and show your pdf?



Thanks in advance 




You received this message because you are subscribed to a topic in the Google Groups "wkhtmltopdf General" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/wkhtmltopdf-general/Re3FvYsAmEo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to wkhtmltopdf-gen...@googlegroups.com.

Ashish Kulkarni

unread,
Jun 11, 2014, 3:29:42 PM6/11/14
to wkhtmltop...@googlegroups.com
If it doesn't work on the latest version of Chrome, it is unlikely to work in wkhtmltopdf which has the same rendering engine as Chrome 13 (August 2011) -- we are planning to upgrade to Qt5, but that is still some months off in the future.

NATTAPONG

unread,
Jun 12, 2014, 5:00:54 AM6/12/14
to wkhtmltop...@googlegroups.com
Thanks Ashish Kulkarni for your great works.

in this situation , Do you have a trick to solve my problem? or Where
can i stop cutting mechanism that break TBODY in you library?

Best regards

Ashish Kulkarni

unread,
Jun 12, 2014, 10:22:45 AM6/12/14
to wkhtmltop...@googlegroups.com
No. You might want to try some Javascript to cut it up yourself, but you might not get good results with it.

Christian Soseman

unread,
Jun 17, 2015, 2:44:27 PM6/17/15
to wkhtmltop...@googlegroups.com
Has anyone found a workaround for this issue? I've been spending a lot of time trying to find a solution to this issue and haven't had any luck whatsoever.

Ashish Kulkarni

unread,
Jun 19, 2015, 1:45:13 AM6/19/15
to wkhtmltop...@googlegroups.com
Unfortunately, there is no good solution for this. The rendering part
of WebKit is quite complicated and not too suited for printing to a
paginated medium [1]. Whatever improvements have been done in
wkhtmltopdf are hacks, and break down on corner-cases/

[1] http://www.webkit.org/projects/printing/
Reply all
Reply to author
Forward
0 new messages