Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » problem in generating PDF reports from linux system(Report Engine in Linux machine is generating 0 size PDF reports)
problem in generating PDF reports from linux system [message #549347] Mon, 26 July 2010 13:48 Go to next message
sudhir  is currently offline sudhir
Messages: 7
Registered: September 2009
Junior Member
Hi,

I am getting problems in generating PDF report from linux system.

PDF reports are generated properly if i run the program from windows system.

I have copied the ReportEngine from windows system to linux system.

Any help is appreciated.

Let me know, in case you need more information.

Thanks

Sudhir
Re: problem in generating PDF reports from linux system [message #549357 is a reply to message #549347] Mon, 26 July 2010 13:50 Go to previous messageGo to next message
Tobias is currently offline Tobias
Messages: 9
Registered: November 2009
Junior Member
On 26.07.2010 15:48, sudhir wrote:
> Hi,
>
> I am getting problems in generating PDF report from linux system.
>
> PDF reports are generated properly if i run the program from windows
> system.
>
> I have copied the ReportEngine from windows system to linux system.
>
> Any help is appreciated.
>
> Let me know, in case you need more information.
>
> Thanks
>
> Sudhir

Any errors or messages?

I'm runnning a Linux myself and have no problems generating reports...
Re: problem in generating PDF reports from linux system [message #549527 is a reply to message #549357] Tue, 27 July 2010 06:24 Go to previous message
sudhir  is currently offline sudhir
Messages: 7
Registered: September 2009
Junior Member
Not getting any error in console or in logs.

I am using following code.

 
/* Partie initialisation */
		ReportEngine engine = null;
		EngineConfig engineConfig = new EngineConfig();
		engineConfig.setEngineHome(birtPath);
		File logDir = new File(strLogDir);
		if (!logDir.exists()) {
			logDir.mkdir();
		}
		if (log) {
			engineConfig.setLogConfig(strLogDir, Level.INFO);
		} else {
			engineConfig.setLogConfig(strLogDir, Level.OFF);
		}

		try {
			engine = new ReportEngine(engineConfig);
			// Dont remove this code.If birt engine path is valid but it does
			// not contain
			// Birt Engine then it will validate Report engine object.
			engine.getRootScope();
		} catch (Exception e) {
			e.printStackTrace();
			Main
					.getLogger()
					.log(
							"Error: Reporting engine path does not contain valid Birt Engine.");
			ReportingUIErrorWriter.process(ReportingUIErrorProcessor
					.getString("ERR_CODE_025"), null);
			systemExit(FAILURE);
		}

		IReportRunnable design = null;
		RenderOptionBase option = new RenderOptionBase();

		if ((format.toLowerCase() != "pdf") && (format.toLowerCase() != "html"))
			format = "pdf"; // format par défaut
		option.setOutputFormat(format.toLowerCase()); // Format du fichier de
		// sortie

		/* Fin initialisation */
		/* Préparation de l'édition */
		try {
			design = engine.openReportDesign(templateLoc);
		} catch (EngineException e) {
			Main.getLogger().log(
					"Warning : Fail to open report Design file : "
							+ e.getMessage());
			ReportingUIErrorWriter.process(ReportingUIErrorProcessor
					.getString("ERR_CODE_026"), null);
			systemExit(FAILURE);
		} catch (Exception e) {
			e.printStackTrace();
			if (e instanceof NullPointerException) {
				Main.getLogger().log(
						"Error: Reporting engine path is not correct.");

				// Destroy the engine object.
				if (engine != null) {
					engine.destroy();
					engine = null;
				}
				ReportingUIErrorWriter.process(ReportingUIErrorProcessor
						.getString("ERR_CODE_027"), null);
				systemExit(FAILURE);
			}
		}

		try {
			/*
			 * Changement de source inspiré de
			 * http://jsourcery.com/api/sourceforge/openreports/2.1/org/efs/openreports/engine/BirtReportEngine.source.html
			 */
			ReportDesignHandle reportDH = (ReportDesignHandle) design
					.getDesignHandle();

			List birtDataSources = reportDH.getAllDataSources();
			Iterator iterator = birtDataSources.iterator();

			while (iterator.hasNext()) {
				OdaDataSourceHandle dataSH = (OdaDataSourceHandle) iterator
						.next();

				try {
					// Mantis 04034, 04037 : Update FILELIST property for the
					// data source with name "Source".
					if (dataSH.getProperty("name").equals("Source")) {
						dataSH.setStringProperty("FILELIST", dataSource
								.getAbsolutePath());
					}
				} catch (SemanticException e) {
					Main.getLogger().log(
							"Warning : SemanticException in path change"
									+ e.getMessage());
					systemExit(FAILURE);
				}
			}
			
			//drop Grid rows containing information about Location Host and Location Components.
			if(!isSummaryReport){
				if(isDetailedLocInfoDisabled){			
					reportDH.getElementByID(1112).dropAndClear();  // delete and clear the location hostname attribute			
					reportDH.getElementByID(1116).dropAndClear(); // delete and clear the location components attribute
				}				
			}
			
			design.setDesignHandle(reportDH);
			/* Fin changement source */
			IRunAndRenderTask task = engine.createRunAndRenderTask(design);
			/* Fin de la préparation */

			/* Création PDF */
			option.setOutputFileName(outputFile + format); // Nom du fichier de
			// sortie
			task.setRenderOption(option); // Chargement du fichier		
			
			if (!isSummaryReport) {
				if (isWithout_DescInConfigFile) {
					task.setParameterValue("withoutDesc", new Boolean(isWithout_DescInConfigFile).toString());
				}
				if (isWithMessInConfigFile) {
					task.setParameterValue("withMess", new Boolean(isWithMessInConfigFile).toString());
				}
			}else{
				task.setParameterValue("totalDuration", XMLReportParsing.totalDurationString.substring(1, XMLReportParsing.totalDurationString.length()-2));
			}

			/* Fin création PDF */
			try {
				// On crée le fichier où l'on va écrire. S'il existe déjà, on
				// écrit à la suite
				task.run(); // Déclenchement de l'édition
				// ferme le fichier qui log le run de BIRT
			} catch (EngineException e) {
				e.printStackTrace();
				Main.getLogger().log(
						"Error in Report Generation : " + e.getMessage());
				ReportingUIErrorWriter.process(ReportingUIErrorProcessor
						.getString("ERR_CODE_028"), null);
				systemExit(FAILURE);
			}
			task = null;
		} catch (Exception e) {
			e.printStackTrace();
			Main.getLogger().log(
					"Error in Report Generation : " + e.getMessage());
			ReportingUIErrorWriter.process(ReportingUIErrorProcessor
					.getString("ERR_CODE_028"), null);
			systemExit(FAILURE);
		}



I was suspecting it an issue of fonts file etc. as i used Arial font family in my report design. So I tried copying arial.ttf from my windows machine to Linux machine but still no success.
Previous Topic:BIRT - Tomcat: Running problem (please help, probably very easy!)
Next Topic:Cannot edit report in word doc format
Goto Forum:
  


Current Time: Wed Oct 01 18:34:06 GMT 2014

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

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