Uploaded image for project: 'FOP'
  1. FOP
  2. FOP-2819

Fop is not rendering last page if width of page is not the same as previous page



    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.3
    • Fix Version/s: None
    • Component/s: fo/page
    • Labels:
    • Environment:
      java 8. Embedded Fop from java application. Windows 10. FOP 2.3
    • Flags:


      During rendering pdf with content that fits entirely to body region page breaking algorithm incorrectly defines necessity of rendering of last page. If region-after does not fit to layout entirely after body region that last page is not rendered if width of last page simple page master differs from width of only page simple page master.

      As I understood, in versions 2.0-2.2 it tries to define the last page presence but because of content of body region was at one page it just renders only page layout with hiding all element from body that after static region overflows.

      In version 2.3 it was fixed by change commited for FOP-2713 bug by simon steiner

      However it not handles situation for pages with different width. We are generate pdf with different width for some of our functionality but we couldn't manage to render it correctly for case when body region is slightly bigger to be fitted to one page layout(only) but smaller to be rendered for two pages layouts. As a workaround we now use the max of the size for both pages. 

      It would be great if you fix this behavior in next releases. 

      As I understood the problem is in PageBreaker#redoLayout  method. On line number 470

       we are getting 

      boolean ipdChange = algRestart.getIPDdifference() != 0;

      this variable is true for situation when pages have different width and it defines later on on line 478 do we adding last page or not. If width of last page simple page master is different than other simple page masters width than last page is not rendered because of it. 

      I haven't figured out the all dependencies but I think that algorithm that breaks pages is not expecting anything about possibility of existence of pages with different width.

      I haven't managed to render two page pdf using binary fop. Maybe it because of fonts missing or hyphenation files missing settings. I hope that you will succeed with it.


        1. workaround.fo
          178 kB
          Oleg Sydorenko
        2. incorrect two page.fo
          194 kB
          Oleg Sydorenko
        3. expected.pdf
          61 kB
          Oleg Sydorenko
        4. actual.pdf
          17 kB
          Oleg Sydorenko



            • Assignee:
              OlegSydorenko Oleg Sydorenko
            • Votes:
              0 Vote for this issue
              1 Start watching this issue


              • Created: