Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Wrong page number with dynamic text field (Separate run/render task)
Wrong page number with dynamic text field (Separate run/render task) [message #1000747] Tue, 15 January 2013 11:25 Go to next message
André Schade is currently offline André SchadeFriend
Messages: 5
Registered: August 2012
Junior Member
Hello BIRT friends,

I have a very simple BIRT report with one dynamic text field and a long constant text. It forces a page break, when I create a PDF file.

There is no problem, if I use a RunAndRenderTask to create this report as PDF. The page numbers are: 1/2, 2/2. (as expected)

But if I use a separate run and render task, the text is included twice, and the page numbers are: 1/2, 1/2, 2/2, 2/2. (The PDF file has 4 pages)

I use following code for rendering. (I know that RunAndRenderTask works, but I need it in that way for further manipulations)

final IRunTask runTask = this.engine.createRunTask(this.design);
runTask.run(temporaryBirtDocument.getCanonicalPath());
final IReportDocument reportDocument = this.engine.openReportDocument(temporaryBirtDocument.getCanonicalPath());
final IRenderTask renderTask = this.engine.createRenderTask(reportDocument);
renderTask.setRenderOption(this.renderOptions);
renderTask.render();
runTask.close();


If I change the Layout of the BIRT report from "Fixed Layout" to "Auto Layout" everything works fine. But this is not a solution for me.

Do you know this problem? Do you have a solution for me?

I am using BIRT 3.7.2. The sample report is attached.
Re: Wrong page number with dynamic text field (Separate run/render task) [message #1000793 is a reply to message #1000747] Tue, 15 January 2013 12:49 Go to previous messageGo to next message
André Schade is currently offline André SchadeFriend
Messages: 5
Registered: August 2012
Junior Member
I think this could be BUG:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=326513
Re: Wrong page number with dynamic text field (Separate run/render task) [message #1000815 is a reply to message #1000793] Tue, 15 January 2013 13:15 Go to previous messageGo to next message
André Schade is currently offline André SchadeFriend
Messages: 5
Registered: August 2012
Junior Member
I have found out some more:

If I change the "Content Type" of the "Dynamic Text Field" from "Auto" to "Plain", everything works fine. "HTML" don't work. *ARG* Sad

[Updated on: Tue, 15 January 2013 13:16]

Report message to a moderator

Re: Wrong page number with dynamic text field (Separate run/render task) [message #1000991 is a reply to message #1000815] Tue, 15 January 2013 20:39 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

Can you attach the java file you use to run the report?

Michael

Developer Evangelist, Silanis
Re: Wrong page number with dynamic text field (Separate run/render task) [message #1006034 is a reply to message #1000991] Tue, 29 January 2013 15:39 Go to previous message
André Schade is currently offline André SchadeFriend
Messages: 5
Registered: August 2012
Junior Member
Ok, I've created a very simple renderer that shows the problem. (also see attachment) I've also attached the created output file, so you can see, what the problem is.

package de.drehpunkt.rotorsoft.report.launcher.test;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.logging.Level;

import org.eclipse.birt.core.exception.BirtException;
import org.eclipse.birt.core.framework.Platform;
import org.eclipse.birt.report.engine.api.EngineConfig;
import org.eclipse.birt.report.engine.api.IRenderOption;
import org.eclipse.birt.report.engine.api.IRenderTask;
import org.eclipse.birt.report.engine.api.IReportDocument;
import org.eclipse.birt.report.engine.api.IReportEngine;
import org.eclipse.birt.report.engine.api.IReportEngineFactory;
import org.eclipse.birt.report.engine.api.IReportRunnable;
import org.eclipse.birt.report.engine.api.IRunTask;
import org.eclipse.birt.report.engine.api.PDFRenderOption;

public class SimpleTestRenderer {

	public static void main(final String[] args) throws BirtException, IOException {
		IRunTask runTask = null;
		try {
			// Start birt platform
			final EngineConfig engineConfig = new EngineConfig();
			engineConfig.setLogConfig("log", Level.ALL);
			engineConfig.setLogMaxBackupIndex(50);
			Platform.startup(engineConfig);
			final IReportEngineFactory factory = (IReportEngineFactory) Platform
					.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
			final IReportEngine engine = factory.createReportEngine(engineConfig);

			// Open design file
			final IReportRunnable design = engine.openReportDesign(new FileInputStream("foundation/reports/test/toc_test.rptdesign"));

			// Create and run "run task"
			final File temporaryBirtDocument = File.createTempFile("birt", "report");
			runTask = engine.createRunTask(design);
			runTask.run(temporaryBirtDocument.getCanonicalPath());

			// Define PDF render options
			final IRenderOption renderOptions = new PDFRenderOption();
			renderOptions.setOutputFileName("foundation/reports/test/output.pdf");
			renderOptions.setOutputFormat(PDFRenderOption.OUTPUT_FORMAT_PDF);
			((PDFRenderOption) renderOptions).setEmbededFont(true);

			// Start render task
			final IReportDocument reportDocument = engine.openReportDocument(temporaryBirtDocument.getCanonicalPath());
			final IRenderTask renderTask = engine.createRenderTask(reportDocument);
			renderTask.setRenderOption(renderOptions);
			renderTask.render();
		} finally {
			if (runTask != null) {
				runTask.close();
			}
			Platform.shutdown();
		}
	}

}



I have realy no idea, what the problem is. I hope some of you can help me.

Best regards,
André
Previous Topic:Row numbers for crosstab in a table
Next Topic:Web Viewer Fails to Aggregate
Goto Forum:
  


Current Time: Wed Jul 01 19:18:45 GMT 2015

Powered by FUDForum. Page generated in 0.02094 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software