amitdivya / dompdf

Automatically exported from code.google.com/p/dompdf
0 stars 0 forks source link

page-break-inside:avoid bad break next element #515

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
With this HTML:
<div style="page-break-inside:avoid">
    <div class="top">top top top top top top top top top top top top top top top top top top top top top top top top top top top toptop top top top top top top top top top top top top toptop top top top top top top top top top top top top top </div>
    <div class="bottom">bottom bottom bottom bottom bottom bottom bottom bottom bottom bottom bottom bottom bottom bottom bottom bottom bottom bottom bottom bottom bottom bottom bottom bottom </div>
</div>

This piece of code when dompdf need to break a page, put this element in next 
page, all fine. But, inside of element div.bottom look bad.

What is the expected output? What do you see instead?
nicely formatted, without bad tab inside div.bottom.

What version of dompdf are you using? What version of PHP? On what
operating system?

dompdf 0.6.0
PHP 5.3.1 linux

Please provide the HTML source code you want to convert, or any additional
information.

Original issue reported on code.google.com by jonasfon...@mugnetic.com on 12 Jul 2012 at 8:55

GoogleCodeExporter commented 9 years ago
Your test case seems to be lacking something. I tested with what you provided 
(using a height-styled div to pad above your code) and it renders fine. Can you 
post a more complete example and test it to ensure the issue is present?

Original comment by eclecticgeek on 13 Jul 2012 at 3:14

GoogleCodeExporter commented 9 years ago
Sure, i will post little code about this issue. One moment

Original comment by jonasfon...@mugnetic.com on 13 Jul 2012 at 8:18

GoogleCodeExporter commented 9 years ago
Hello, this is an attach file only to see what real happen....

Original comment by jonasfon...@mugnetic.com on 13 Jul 2012 at 5:34

Attachments:

GoogleCodeExporter commented 9 years ago
I presume that the second answer shouldn't be indented with overlapping text 
and that there shouldn't be so much space between the second and third answer. 
How does it look if the content doesn't flow to a new page (e.g. use 
page-break-before: always; on the container)?

Can you post some sample HTML so we can debug the issue?

Original comment by eclecticgeek on 13 Jul 2012 at 9:45

GoogleCodeExporter commented 9 years ago
Hello, the space between text it's wrong, when dompdf need to break a page and 
transport block html to another page, give same results... 

I will post sample code, one moment... i will try produced the same with 
another code. 

Original comment by jonasfon...@mugnetic.com on 13 Jul 2012 at 10:46

GoogleCodeExporter commented 9 years ago
I have the same issue as mentioned by Jonas. Please see the attached image

Original comment by bya...@velsof.com on 6 Sep 2012 at 1:49

Attachments:

GoogleCodeExporter commented 9 years ago
At the moment i can't post sample code, but happend to me! Same bug!

Original comment by jonathan...@gmail.com on 6 Sep 2012 at 2:02

GoogleCodeExporter commented 9 years ago
Same problem here when using page-break-inside:avoid;

It seems to be related to margins on the body (ie for headers and footers). I 
have a fixed position header and footer on each page so the body has a css 
margin of 2.5cm to account for this. If I remove the margin on the body then 
these gaps disappear - I assume that when a page break is needed it seems to be 
applying the body margin after the page break element.

I'm hunting for the bug now and will update if I find a fix.

Original comment by lew...@gmail.com on 13 Sep 2012 at 2:54

GoogleCodeExporter commented 9 years ago
Man you rocks! Many Thanks for this solution... :) If i can help, please 
contact me, i glad to help in any code :P

The Best,
Jonathan Fontes

Original comment by jonathan...@gmail.com on 13 Sep 2012 at 2:57

GoogleCodeExporter commented 9 years ago
I've never looked at the dompdf code before so it may take a while... Current 
suspect is in page_frame_decorator.cls.php around line 430... There's a bunch 
of code to do with checking margins when doing page breaks... And one of the 
comments starts with 'FIXME' so I'm thinking there may be a bug there ;)

Original comment by lew...@gmail.com on 13 Sep 2012 at 3:17

GoogleCodeExporter commented 9 years ago
aahahaha, nice. One FIXME maybe suspect... :D

Original comment by jonathan...@gmail.com on 13 Sep 2012 at 3:34

GoogleCodeExporter commented 9 years ago
I just tried the nightly build and the bug seems to be fixed for me. Don't have 
the time to figure out where exactly but try updating!

Original comment by lew...@gmail.com on 13 Sep 2012 at 3:39

GoogleCodeExporter commented 9 years ago
ok, i will try update, you can give the download link ?

Original comment by jonathan...@gmail.com on 13 Sep 2012 at 3:41

GoogleCodeExporter commented 9 years ago
http://eclecticgeek.com/dompdf/nightly.php?format=zip

Original comment by lew...@gmail.com on 13 Sep 2012 at 3:44

GoogleCodeExporter commented 9 years ago
PS this may introduce further bugs (nightly = not stable release) but it at 
least seemed to fix this one for me.

Original comment by lew...@gmail.com on 13 Sep 2012 at 3:45

GoogleCodeExporter commented 9 years ago
Yeah, i know about this. I will test with other cases scenarios, to check if 
all going well and if fixed the bug. Thanks about this. :)

The Best,
Jonathan Fontes

Original comment by jonathan...@gmail.com on 13 Sep 2012 at 3:46

GoogleCodeExporter commented 9 years ago
mm this problem still with me...
Tried removing tables & applying Divs..
then the new problem is floating trouble...
I have turned on the float in config tooo.. 

So looking for a solution ! :)

Original comment by cody...@gmail.com on 30 Nov 2012 at 4:35

GoogleCodeExporter commented 9 years ago
Oh nice, i just wanted to report the (probably) same bug, so heres my report:

Creating a script for automatically generating catalogue PDFs, I noticed a 
strange behaviour in some cases when using dompdf to display divs containing 
tables. Since I could not find any info on that particular thing, I created a 
test file and could narrow down a part of the problem to one particular css 
setting.

REPRODUCTION:
to reproduce with the attached template.php file: set dompdf to use inline php, 
dpi to 96, paper to A4 portrait

The attached file uses its embedded style definition to define 
- divs with class "nobreak" as -> page-break-inside:avoid; and grey border/bg
- divs with class "inside" as -> width:400px; and red border/bg

The body code is quite simple, just having "nobreak" divs containing 2 "inside" 
divs each, and inside those several lines of text.

EXPECTED: 
If possible (due to height of "nobreak" div), all "nobreak" divs should not 
have a page break inside. 

RESULT: 
"nobreak" divs are (just check the css bounding boxes) often rendered partly on 
the page they wouldn't fit in, partly on the other page. However their content 
is entirely being rendered on the next page. This would be ok for me, but in 
unluckily the "nobreak" div gains height it doesn't need, like an additional 
padding-bottom. 

FINDING: 
If I comment out the line specifying the "inside" div width (line 32), the 
height-gaining problem disappears. But still the "nobreak" divs will start 
rendering on the previous page.

VERSION:
I am currently using dompdf 0.6.0 b3. I also tried using a nightly version (as 
recommended by lewiji) I downloaded about three weeks ago, but that seemed to 
completely ignore the page-break-inside:avoid; ...
I am testing on local Server on my Computer here Windows 7 Enterprise 32bit 
(PHP 5.3.5) and on an Online Server using some Linux version (PHP 5.3.15). 

4 attached files:
dompdf.config.inc.php (for dompdf 0.6.0 b3)
createpdf.php (containing the rendering code, just 10 lines)
template.php (containing inline php and html code to render as pdf)
and the pdf file of the result I am getting.

Thanks in advance for looking into that problem. :)

Original comment by christia...@gmail.com on 4 Dec 2012 at 10:13

Attachments:

GoogleCodeExporter commented 9 years ago
i am generating an HTML to PDF. the dompdf creates one page PDF and the the 
rest of HTML is not shown. how can i extend my report to two pages of PDF.? plz 
guide me

Original comment by szubai...@gmail.com on 15 Dec 2012 at 8:11

GoogleCodeExporter commented 9 years ago

Original comment by eclecticgeek on 24 May 2013 at 3:00