steven0lisa / flying-saucer

Automatically exported from code.google.com/p/flying-saucer
0 stars 0 forks source link

PDF empty page bug when trying to avoid page break - testcase included #57

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
*** This issue was imported from http://java.net/jira/browse/XHTMLRENDERER-295

It was reported by simonhartley on 26.11.2009 17:56:44 +0100 and last updated 
in the previous bug tracker on 15.01.2010 20:33:20 +0100

Found in
Operating System: All
Platform: All

The priority for this issue at migration was Major.
The original issue had attachments to it; see comments below.

Original description: 
Unwanted empty page at start when using ITextRenderer to generate a PDF from
following XHTML:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>Example Document</title>
    <style type="text/css" media="print">
      div {
        font-size: 220mm;
        page-break-after: avoid;
      }
    </style>
  </head>
  <body>
    <div>a</div>
    <div>b</div>
  </body>
</html>

Original issue reported on code.google.com by pdoubl...@gmail.com on 16 Feb 2011 at 9:47

GoogleCodeExporter commented 9 years ago
Attachment by simonhartley on 26.11.2009 17:57:34 +0100:  together.xhtml, size 
462 bytes
Download: http://java.net/jira/secure/attachment/27405/together.xhtml

Original comment by pdoubl...@gmail.com on 16 Feb 2011 at 9:47

GoogleCodeExporter commented 9 years ago
Attachment by simonhartley on 15.01.2010 20:33:20 +0100:  together2.xhtml, size 
468 bytes
Download: http://java.net/jira/secure/attachment/27406/together2.xhtml

Original comment by pdoubl...@gmail.com on 16 Feb 2011 at 9:47

GoogleCodeExporter commented 9 years ago
simonhartley wrote on 26.11.2009 17:57:34 +0100:
Created an attachment (id=99)
Test case

Original comment by pdoubl...@gmail.com on 16 Feb 2011 at 9:47

GoogleCodeExporter commented 9 years ago
peterbrant wrote on 13.01.2010 22:51:43 +0100:
Hmm... you're creating a line box taller than the height of the page.  The code
assumes that a line box will always fit on a page.  If it overlaps with a page
break, it's moved to the next page.  That's the origin of the blank page.

This seems like kind of a strange thing to want to do.  Marking as WONTFIX for
now, but feel free to reopen if this is creating an actual problem for you.

Original comment by pdoubl...@gmail.com on 16 Feb 2011 at 9:47

GoogleCodeExporter commented 9 years ago
simonhartley wrote on 15.01.2010 20:32:11 +0100:
Perhaps when trying to have construct a simple test case I distorted the 
problem.

Here's an updated test case where each div fits on the page. In fact the first
two divs share the same page and so should not be causing an empty page, as they
could have a page each if necessary.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Example Document</title>
        <style type="text/css" media="print">
            div {
                font-size: 120mm;
                page-break-after: avoid;
            }
        </style>
    </head>
    <body>
        <div>a</div>
        <div>b</div>
        <div>c</div>
    </body>
</html>

Original comment by pdoubl...@gmail.com on 16 Feb 2011 at 9:47

GoogleCodeExporter commented 9 years ago
simonhartley wrote on 15.01.2010 20:33:20 +0100:
Created an attachment (id=111)
Updated test case

Original comment by pdoubl...@gmail.com on 16 Feb 2011 at 9:47