Bug 423443 - Incorrect page break when running report. Padding not included in calculation.
Summary: Incorrect page break when running report. Padding not included in calculation.
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: BIRT (show other bugs)
Version: 4.2.2   Edit
Hardware: PC Linux
: P3 major with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Birt-ReportEngine-inbox@eclipse.org CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-06 10:41 EST by Jan Inowolski CLA
Modified: 2014-02-02 08:19 EST (History)
1 user (show)

See Also:


Attachments
example report design (5.31 KB, application/octet-stream)
2013-12-06 10:41 EST, Jan Inowolski CLA
no flags Details
example output (1.68 KB, application/pdf)
2013-12-06 10:45 EST, Jan Inowolski CLA
no flags Details
example report design (3.93 KB, application/octet-stream)
2013-12-06 10:45 EST, Jan Inowolski CLA
no flags Details
Test report covering both bugs (6.63 KB, application/octet-stream)
2013-12-19 14:42 EST, Jan Inowolski CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Inowolski CLA 2013-12-06 10:41:31 EST
Created attachment 238121 [details]
example report design

When I generate attached report with separate run and render phases, it is generated with one page and that one page is rendered as two pages in PDF.

1. Open attached report in Web Viewer (there is one page, "page 1 of 1")
2. Export to PDF (there are two pages, both "page 1 of 1")

When generating with RunAndRender it is rendered correctly: there are two pages "page 1 of 2" and "page 2 of 2".

This bug causes rendering issues in a number of our reports, sometimes in the middle of a long one.

Workaround is e.g. changing top padding to top margin in the first (green X) element. Another workaround is to change first element content type from HTML to Plain. But it cannot be HTML and have top padding at the same time without possibility of rendering issues.
Comment 1 Jan Inowolski CLA 2013-12-06 10:45:05 EST
Created attachment 238122 [details]
example output
Comment 2 Jan Inowolski CLA 2013-12-06 10:45:45 EST
Created attachment 238123 [details]
example report design
Comment 3 Jan Inowolski CLA 2013-12-15 15:08:38 EST
Bug occurs only with Fixed Layout report. 

When report layout is set to Auto Layout, report has one (1/1) page in the preview ("view in the web browser") and two (1/2, 2/2) in the PDF exported from the web browser.
Comment 4 Jan Inowolski CLA 2013-12-17 05:28:00 EST
I think it was introduced while fixing Bug 386238 in 4.2.2 (4.2.1 is not affected). 

In the LayoutEngine (org.eclipse.birt.report.engine.nLayout), method startForeign( IForeignContent foreign ) there is a special case for Fixed Layout and RunTask:

if ( context.isFixedLayout( )
		&& context.getEngineTaskType( ) == IEngineTask.TASK_RUN
		&& IForeignContent.HTML_TYPE.equals( foreign.getRawType( ) ) )
{
	HTML2Content.html2Content( foreign );
	processHTML( foreign );
}

It changes the way of breaking page in the ContainerArea.checkPageBreak()(org.eclipse.birt.report.engine.nLayout.area.impl). Condition in while loop:

while ( aHeight + parent.getAbsoluteBP( ) - 3000 > context.getMaxBP( ) )

always evaluates to false, because maxBP is set to Integer.MAX_VALUE in ForeignHTMLRegionLayout line 43 (org.eclipse.birt.report.engine.nLayout.area.impl).

This is one of the stacks I have noted to myself while debugging this (it is in the "else" branch of the mentioned if):

Thread [qtp902166098-40 - /viewer/frameset?__report=%2Fhome%2Fjankiel%2Fruntime-EclipseApplication%2Ftest-report-project%2Fpage_bug.rptdesign&__format=html&__svg=false&__locale=en_US&__timezone=Poland&__masterpage=true&__rtl=false&__cubememsize=10&__resourceFolder=%2Fhome%2Fjankiel%2Fruntime-EclipseApplication%2Ftest-report-project&&1386296701&__sessionId=20131216_153515_111&__dpi=96] (Suspended)
    BlockContainerArea(ContainerArea).getOffsetY() line: 773
    BlockContainerArea(ContainerArea).getAbsoluteBP() line: 145
    BlockContainerArea(ContainerArea).getAbsoluteBP() line: 145
    LineArea(ContainerArea).checkPageBreak() line: 748
    LineArea.close(boolean, boolean) line: 476
    LineArea.close() line: 506
    LayoutEngine.closeContainer() line: 376
    LayoutEngine._endContainer(IContent) line: 486
    LayoutEngine.endContainer(IContainerContent) line: 361
    ContentEmitterUtil$EndContentVisitor.visitContainer(IContainerContent, Object) line: 323
    ContainerContent.accept(IContentVisitor, Object) line: 42
    ContentEmitterUtil$EndContentVisitor.visit(IContent, Object) line: 300
    ContentEmitterUtil.endContent(IContent, IContentEmitter) line: 136
    LayoutEngine.visitContent(IContent, IContentEmitter) line: 727
    LayoutEngine.startForeign(IForeignContent) line: 767
    ContentEmitterUtil.startContent(IContent, IContentEmitter) line: 77
    HTMLPageBuffer.startContent(IContent, IContentEmitter, boolean) line: 116
    TableBreakBuffer.startContent(IContent, IContentEmitter, boolean) line: 287
    HTMLLeafItemLM.start(boolean) line: 67
    HTMLLeafItemLM(HTMLAbstractLM).layout() line: 139
    HTMLPageLM(HTMLBlockStackingLM).layoutNodes() line: 70
    HTMLPageLM.layout() line: 92
    HTMLReportLayoutEngine.layout(IReportExecutor, IReportContent, IContentEmitter, boolean) line: 100
    ReportDocumentBuilder.build() line: 249
    RunTask.doRun() line: 269


I haven't enough knowledge of BIRT report rendering algorithm to debug this further; hope this clues will help fixing bug.

I'm changing importance to Major as it cases severe problem in rendering PDF reports.
Comment 5 Jan Inowolski CLA 2013-12-19 14:42:18 EST
Created attachment 238501 [details]
Test report covering both bugs

This report renders incorrectly in both 4.2.1 and 4.2.2+.

 4.2.1:
PAGE 1: 1/4Lorem ipsum...
PAGE 2: 1/4Quisque cursus...
PAGE 3: 2/4Lorem ipsum...
PAGE 4: 2/4Quisque cursus...
PAGE 5: 3/4Lorem2 ipsum...
PAGE 6: 3/4Quisque cursus et...
PAGE 7: 4/4Lorem2 ipsum...
PAGE 8: 4/4Quisque cursus...

 4.2.2+:
PAGE 1: 1/2 Lorem ipsum...
PAGE 2: 1/2 Quisque cursus...
PAGE 1: 2/2 Lorem2 ipsum...
PAGE 2: 2/2 Quisque cursus...

 Expected:
PAGE 1: 1/3 Lorem ipsum...
PAGE 2: 2/3 Quisque cursus...
PAGE 3: 3/3 blandit eu...