Forcing the page breaking of images

1,125 views
Skip to first unread message

Joel Peltonen

unread,
Jul 12, 2012, 6:40:21 AM7/12/12
to wkhtmltop...@googlegroups.com
Greetings!

How would you suggest I handle page breaking large images? My HTML is created dynamically and as such I can't rely on images being at a certain point in pages. I often have large images that take up about half of the available area on a page - currently they break inside in two pages very often, but I don't know how to avoid it. 

HTML

<div class="Image"><img src="http://localhost:59738/Image/parts-01.jpg?scale=100"></div>

CSS
img {
page-break-inside: avoid;
}

.Image{
page-break-inside: avoid;
}

These rules have no effect on printing and the images still break between pages. Any ideas? 

I know that this depends strongly on webkit, but I'm under pressure to solve this issue and I believe that webkit will most likely not fix this anytime soon (their bugreport originates circa 2005) so this is starting to look very scary.

- Joel

Adam Hyde

unread,
Jul 12, 2012, 6:43:47 AM7/12/12
to wkhtmltop...@googlegroups.com
i have had no problems with the images breaking over pages when using headers and footers, maybe thats part of the secret?

adam


- Joel

--
===================================================
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

Joel Peltonen

unread,
Jul 12, 2012, 7:42:23 AM7/12/12
to wkhtmltop...@googlegroups.com
I'm really sorry, I found that the problem was with some tags but not
others because some tags had align="left" defined because they came
from an earlier system that I'm replacing. My bad! I really should
have checked the source more closely sooner, but I simply was too
distracted in thinking that the problem was with the CSS.

Thank you very much for your quick reply and sorry to waste your time!

- Joel

Adam Hyde

unread,
Jul 12, 2012, 11:30:45 AM7/12/12
to wkhtmltop...@googlegroups.com
glad it worked out :)
Reply all
Reply to author
Forward
0 new messages