Bug 444142 - ReportEngine genreport Run and Render Causes Extra Blank Pages
Summary: ReportEngine genreport Run and Render Causes Extra Blank Pages
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: BIRT (show other bugs)
Version: 4.2.2   Edit
Hardware: PC Windows 7
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Birt-ReportEngine-inbox@eclipse.org CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-15 12:56 EDT by GSG Solutions CLA
Modified: 2016-08-04 07:00 EDT (History)
1 user (show)

See Also:


Attachments
Report design used for testing validation. No database required. (17.69 KB, application/octet-stream)
2014-09-15 12:56 EDT, GSG Solutions CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description GSG Solutions CLA 2014-09-15 12:56:54 EDT
Created attachment 247081 [details]
Report design used for testing validation. No database required.

The issue: 
•	When running genreport.bat (or .sh on AIX), using the -m run AND render mode (two step), generating a PDF file, I am getting extra blank page(s) on the PDF that is being caused by a label at the bottom of the report design where the label's text is a long string (set in onCreate) BUT the label's visibility is set to hide it from PDF.


What I've tested/experienced:
•	Issue does not occur when using the runrender mode (single step)
We produce multiple output types from a single rptdesign so for performance reasons, using multiple runrender is not feasible
•	Issue does not occur when using "view report as PDF" in Eclipse (tested there just to be sure)
•	Issue does not occur if the label's text is reduced/shortened so that it does not span a "page"
Number of extra pages seems to correspond with the amount of "data" that is associated with the label
•	Issue does not occur if the label's visibility is set to hide for all outputs
•	Issue does not occur if I put the label between two tables that have data
•	Issue DOES occur if I put another element (label, text, dyn text) below it regardless if it has data or not or how it's visibility is set
•	Tried changing the label's this.text dynamically within it's onRender script, but no luck
•	Tried dropping the label from within the beforeRender script, but no luck
•	Changing the label to text or dynamic text produced the same results
•	Using the following in the label's onRender event does not work: if (reportContext.getRenderOption().getOptions().get("format") == "pdf") { this.text = ""; }
•	Using the following in the label's onRender event does not work: if (outputFormat == Packages.org.eclipse.birt.report.engine.api.IRenderOption.OUTPUT_FORMAT_PDF) { this.text = ""; }
•	Using the following in the label's onRender event does not work: if(reportContext.getHttpServletRequest().getAttribute("attributeBean").format == "pdf"){ reportContext.getDesignHandle().findElement("lbl_TextData").drop(); }




How you can recreate:
•	I've attached a sample report design and a copy of the genreport.bat that I'm using
•	There is no data source, no data set, no parameters, no masterpage, just a simple design with two grids (full visibility) containing labels and the label (hidden for PDF)
•	Download and unzip birt-runtime-4_2_2.zip (eclipse.org/downloads/download.php?file=/birt/downloads/drops/R-R1-4_2_2-201302161152/birt-runtime-4_2_2.zip)
•	Execute using 
o	genreport -m run  blank_page_genreport.rptdesign
o	genreport -m render -f PDF  -o c:\temp\blank_page_genreport.pdf blank_page_genreport.rptdocument
•	In the onCreate for the label with text "Grid label 1 - text set in onCreate script", remove the last occurrence of strData, which shortens the data to fit on a "page", this generating no blank page.  Expanding the data will produce additional blank pages.
•	Alternatively, setting the label's visibility to hidden for all outputs will produce no blank page(s)


Same results from birt-runtime-4_4_0-20140611.zip.

To maximize performance, something our clients have come to expect, our process from using BIRT 252 was to run once and render twice (PDF and CSV) thus only executing the queries once.  From what I've been able to determine, when the run task is executed by itself using "genreport -m run" the output format defaults to "pdf" even though none has been specified. This you can get from using reportContext.getOutputFormat() in initialize or beforeFactory.
 
If we drop the element at run time, then there won't be anything there when I go to render the CSV output (or any other type other than PDF).  I need the element, and it's data, there for the second render phase (genreport -m render -f CSV) but I want it to stay hidden when I render for the PDF (genreport -m render -f PDF).  
 
The PDF rendering is rendering pagination of an element that's hidden for PDF, but it's not rendering the data.  That seems like a bug for it to be able to create pages for a type-specific hidden element but without the data.  

If it's smart enough to know NOT to show the hidden element's data when it renders the PDF then it should also know to drop the additional paginations.
Comment 1 Wei Yan CLA 2014-09-15 13:17:00 EDT
It is a know issue as all output formats share the same pagination generated by run task. 

Keep it open to see if we can generate different pagination for different formats in run task.
Comment 2 GSG Solutions CLA 2016-08-04 07:00:21 EDT
(In reply to Wei Yan from comment #1)
> It is a know issue as all output formats share the same pagination generated
> by run task. 
> 
> Keep it open to see if we can generate different pagination for different
> formats in run task.

As of BIRT 4.5.0 this issue still exists. Any updates on if/when if may be adressed?