Home
Analytics
integration OpenXava
el_odiado76
<p>Hello,<br>
I am triying to integrated OpenXava and Birt, but i dont know for where start.<br><span>I have tried with a custom jsp, but it has not worked.<br>
Any Idea?<br><br>
Thanks, and sorry for my bad English</span><br>
</p>
Find more posts tagged with
Comments
el_odiado76
<p>I am trying...this is my code, but i have a "NoClassDefFoundError: org/eclipse/birt/report/engine/api/IRenderOption"<br>
Any help? thanks<br><br>
</p>
<pre class="_prettyXprint _linenums:1">
import org.openxava.actions.TabBaseAction;
import java.io.InputStream;
import org.eclipse.birt.core.framework.Platform;
import org.eclipse.birt.report.engine.api.*;
public class Imprimir extends TabBaseAction {
@Override
public void execute() throws Exception{
try {
// Arrancamos el motor de Birt
Platform.startup();
IReportEngineFactory factory = (IReportEngineFactory) Platform.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
// Leemos el informe para crearlo
InputStream rptDesignInput = this.getClass().getResourceAsStream("/informes/Infor.rptdesign");
IReportRunnable report ;
report=(IReportRunnable) factory.createReportEngine(new EngineConfig()).openReportDesign(rptDesignInput);
// Configuramos el formato de salida
PDFRenderOption pdf = new PDFRenderOption();
pdf.setOutputFileName("output/resample/testpdf.pdf");
pdf.setSupportedImageFormats("PNG;GIF;JPG;BMP;SWF;SVG");
//options.setOption(PDFRenderOption.PAGE_OVERFLOW,IPDFRenderOption.ENLARGE_PAGE_SIZE);
pdf.setOption(PDFRenderOption.PAGE_OVERFLOW,
IPDFRenderOption.FIT_TO_PAGE_SIZE);
pdf.setOption( IRenderOption.HTML_PAGINATION, Boolean.FALSE );
pdf.setOutputFormat("pdf");
// Render y generar
IRunAndRenderTask salida = null;
// TODO ¿para rellenar datos?
//salida.setAppContext(arg0);
//salida.setParameter(arg0, arg1, arg2);
//salida.setParameterValues(arg0);
salida = report.getReportEngine().createRunAndRenderTask(report);
salida.setRenderOption(pdf);
salida.run();
// Destruir motor de generacion
Platform.shutdown();
} catch (Exception e) {
throw new RuntimeException("Could not start the BIRT engine.", e);
}
}
}
</pre>
el_odiado76
<p>Someone have a example?<br>
it will so helpful...please<br>
I dont't understand nothing... :unsure: </p>
Clement Wong
<p>Here are some examples:</p>
<p><a data-ipb='nomediaparse' href='
http://www.eclipse.org/birt/documentation/integrating/reapi.php'>http://www.eclipse.org/birt/documentation/integrating/reapi.php</a></p>
;
<p><a data-ipb='nomediaparse' href='
http://birtworld.blogspot.com/2010/06/birt-excel-output.html'>http://birtworld.blogspot.com/2010/06/birt-excel-output.html</a></p>
;
<p><a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php?/files/file/282-webinar-archive-using-the-birt-report-engine-apis/'>http://developer.actuate.com/community/forum/index.php?/files/file/282-webinar-archive-using-the-birt-report-engine-apis/</a></p>
;
<p> </p>
<p>Also, the DevShare has a ZIP, and when you extract it under API\API\APIs\src\REAPI, you can find examples for RenderTask and RunAndRenderTask:</p>
<p><a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php?/files/file/870-eclipsecon-2011-api-examples/'>http://developer.actuate.com/community/forum/index.php?/files/file/870-eclipsecon-2011-api-examples/</a></p>
;
el_odiado76
<p>Thanks<br>
I will study this documentation.<br>
it is so helpfull, really, thanks.<br>
You cheer my day.<br><br><span><span>i will Notify changes and improvements and <span><span>possible doubts</span></span></span></span></p>
el_odiado76
<p>ok<br>
I trying to modificed the proyect, but i have this problem:<br><br>
</p>
<pre class="_prettyXprint _lang-nocode">
org.eclipse.birt.report.engine.api.EngineException: Error happened while running the report.
at org.eclipse.birt.report.engine.api.impl.EngineTask.handleFatalExceptions(EngineTask.java:2375)
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:191)
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:77)
at org.openxava.datos.actions.Imprimir.execute(Imprimir.java:76)
at org.openxava.controller.ModuleManager.executeAction(ModuleManager.java:535)
at org.openxava.controller.ModuleManager.executeAction(ModuleManager.java:443)
at org.openxava.controller.ModuleManager.execute(ModuleManager.java:404)
at org.apache.jsp.xava.execute_jsp._jspService(execute_jsp.java:256)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:438)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:720)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:584)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:523)
at org.openxava.web.servlets.Servlets.getURIAsStream(Servlets.java:72)
at org.openxava.web.dwr.Module.getURIAsStream(Module.java:214)
at org.openxava.web.dwr.Module.request(Module.java:62)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.directwebremoting.impl.ExecuteAjaxFilter.doFilter(ExecuteAjaxFilter.java:34)
at org.directwebremoting.impl.DefaultRemoter$1.doFilter(DefaultRemoter.java:428)
at org.directwebremoting.impl.DefaultRemoter.execute(DefaultRemoter.java:431)
at org.directwebremoting.impl.DefaultRemoter.execute(DefaultRemoter.java:283)
at org.directwebremoting.servlet.PlainCallHandler.handle(PlainCallHandler.java:52)
at org.directwebremoting.servlet.UrlProcessor.handle(UrlProcessor.java:101)
at org.directwebremoting.servlet.DwrServlet.doPost(DwrServlet.java:146)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at org.eclipse.birt.report.engine.layout.pdf.font.FontHandler.getMappedFont(FontHandler.java:213)
at org.eclipse.birt.report.engine.layout.pdf.font.FontHandler.selectFont(FontHandler.java:172)
at org.eclipse.birt.report.engine.layout.pdf.font.FontSplitter.buildChunk(FontSplitter.java:98)
at org.eclipse.birt.report.engine.layout.pdf.font.FontSplitter.getNext(FontSplitter.java:189)
at org.eclipse.birt.report.engine.layout.pdf.text.ChunkGenerator.getNext(ChunkGenerator.java:104)
at org.eclipse.birt.report.engine.nLayout.area.impl.TextCompositor.getNextTextArea(TextCompositor.java:189)
at org.eclipse.birt.report.engine.nLayout.area.impl.TextCompositor.getNextArea(TextCompositor.java:127)
at org.eclipse.birt.report.engine.nLayout.area.impl.TextAreaLayout.layoutChildren(TextAreaLayout.java:182)
at org.eclipse.birt.report.engine.nLayout.area.impl.TextAreaLayout.layout(TextAreaLayout.java:173)
at org.eclipse.birt.report.engine.nLayout.area.impl.InlineTextArea.layout(InlineTextArea.java:70)
at org.eclipse.birt.report.engine.nLayout.LayoutEngine.startContent(LayoutEngine.java:562)
at org.eclipse.birt.report.engine.emitter.ContentEmitterAdapter.startText(ContentEmitterAdapter.java:147)
at org.eclipse.birt.report.engine.emitter.ContentEmitterAdapter.startLabel(ContentEmitterAdapter.java:153)
at org.eclipse.birt.report.engine.emitter.ContentEmitterUtil.startContent(ContentEmitterUtil.java:65)
at org.eclipse.birt.report.engine.nLayout.LayoutEngine.visitContent(LayoutEngine.java:713)
at org.eclipse.birt.report.engine.nLayout.LayoutEngine.visitContent(LayoutEngine.java:721)
at org.eclipse.birt.report.engine.nLayout.LayoutEngine.startForeign(LayoutEngine.java:764)
at org.eclipse.birt.report.engine.emitter.ContentEmitterUtil.startContent(ContentEmitterUtil.java:77)
at org.eclipse.birt.report.engine.nLayout.LayoutEngine.visitContent(LayoutEngine.java:713)
at org.eclipse.birt.report.engine.nLayout.LayoutEngine.visitChildren(LayoutEngine.java:737)
at org.eclipse.birt.report.engine.nLayout.RegionLayoutEngine.layout(RegionLayoutEngine.java:31)
at org.eclipse.birt.report.engine.nLayout.area.impl.PageArea.layoutFooter(PageArea.java:489)
at org.eclipse.birt.report.engine.nLayout.area.impl.PageArea.initialize(PageArea.java:249)
at org.eclipse.birt.report.engine.nLayout.area.impl.RootArea.createNewPage(RootArea.java:147)
at org.eclipse.birt.report.engine.nLayout.area.impl.RootArea.initialize(RootArea.java:138)
at org.eclipse.birt.report.engine.nLayout.LayoutEngine.setContainer(LayoutEngine.java:366)
at org.eclipse.birt.report.engine.nLayout.LayoutEngine._startContainer(LayoutEngine.java:454)
at org.eclipse.birt.report.engine.nLayout.LayoutEngine.startContainer(LayoutEngine.java:353)
at org.eclipse.birt.report.engine.emitter.ContentEmitterAdapter.startPage(ContentEmitterAdapter.java:65)
at org.eclipse.birt.report.engine.emitter.CompositeContentEmitter.startPage(CompositeContentEmitter.java:290)
at org.eclipse.birt.report.engine.emitter.ContentEmitterUtil.startContent(ContentEmitterUtil.java:47)
at org.eclipse.birt.report.engine.layout.html.buffer.PageNode.start(PageNode.java:49)
at org.eclipse.birt.report.engine.layout.html.buffer.ContainerBufferNode.start(ContainerBufferNode.java:79)
at org.eclipse.birt.report.engine.layout.html.buffer.ContainerBufferNode.start(ContainerBufferNode.java:79)
at org.eclipse.birt.report.engine.layout.html.buffer.ContainerBufferNode.flush(ContainerBufferNode.java:48)
at org.eclipse.birt.report.engine.layout.html.buffer.HTMLPageBuffer.endRow(HTMLPageBuffer.java:209)
at org.eclipse.birt.report.engine.layout.html.buffer.HTMLPageBuffer.endContainer(HTMLPageBuffer.java:140)
at org.eclipse.birt.report.engine.layout.html.buffer.TableBreakBuffer.endContainer(TableBreakBuffer.java:360)
at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.end(HTMLStackingLM.java:42)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:141)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)
at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
at org.eclipse.birt.report.engine.layout.html.HTMLRepeatHeaderLM.layoutChildren(HTMLRepeatHeaderLM.java:46)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)
at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:92)
at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:100)
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:181)
... 54 more
org.eclipse.birt.report.engine.api.EngineException: Error happened while running the report.
at org.eclipse.birt.report.engine.api.impl.EngineTask.handleFatalExceptions(EngineTask.java:2375)
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:191)
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:77)
at org.openxava.datos.actions.Imprimir.execute(Imprimir.java:76)
at org.openxava.controller.ModuleManager.executeAction(ModuleManager.java:535)
at org.openxava.controller.ModuleManager.executeAction(ModuleManager.java:443)
at org.openxava.controller.ModuleManager.execute(ModuleManager.java:404)
at org.apache.jsp.xava.execute_jsp._jspService(execute_jsp.java:256)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:438)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:720)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:584)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:523)
at org.openxava.web.servlets.Servlets.getURIAsStream(Servlets.java:72)
at org.openxava.web.dwr.Module.getURIAsStream(Module.java:214)
at org.openxava.web.dwr.Module.request(Module.java:62)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.directwebremoting.impl.ExecuteAjaxFilter.doFilter(ExecuteAjaxFilter.java:34)
at org.directwebremoting.impl.DefaultRemoter$1.doFilter(DefaultRemoter.java:428)
at org.directwebremoting.impl.DefaultRemoter.execute(DefaultRemoter.java:431)
at org.directwebremoting.impl.DefaultRemoter.execute(DefaultRemoter.java:283)
at org.directwebremoting.servlet.PlainCallHandler.handle(PlainCallHandler.java:52)
at org.directwebremoting.servlet.UrlProcessor.handle(UrlProcessor.java:101)
at org.directwebremoting.servlet.DwrServlet.doPost(DwrServlet.java:146)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at org.eclipse.birt.report.engine.layout.pdf.font.FontHandler.getMappedFont(FontHandler.java:213)
at org.eclipse.birt.report.engine.layout.pdf.font.FontHandler.selectFont(FontHandler.java:172)
at org.eclipse.birt.report.engine.layout.pdf.font.FontSplitter.buildChunk(FontSplitter.java:98)
at org.eclipse.birt.report.engine.layout.pdf.font.FontSplitter.getNext(FontSplitter.java:189)
at org.eclipse.birt.report.engine.layout.pdf.text.ChunkGenerator.getNext(ChunkGenerator.java:104)
at org.eclipse.birt.report.engine.nLayout.area.impl.TextCompositor.getNextTextArea(TextCompositor.java:189)
at org.eclipse.birt.report.engine.nLayout.area.impl.TextCompositor.getNextArea(TextCompositor.java:127)
at org.eclipse.birt.report.engine.nLayout.area.impl.TextAreaLayout.layoutChildren(TextAreaLayout.java:182)
at org.eclipse.birt.report.engine.nLayout.area.impl.TextAreaLayout.layout(TextAreaLayout.java:173)
at org.eclipse.birt.report.engine.nLayout.area.impl.InlineTextArea.layout(InlineTextArea.java:70)
at org.eclipse.birt.report.engine.nLayout.LayoutEngine.startContent(LayoutEngine.java:562)
at org.eclipse.birt.report.engine.emitter.ContentEmitterAdapter.startText(ContentEmitterAdapter.java:147)
at org.eclipse.birt.report.engine.emitter.ContentEmitterAdapter.startLabel(ContentEmitterAdapter.java:153)
at org.eclipse.birt.report.engine.emitter.ContentEmitterUtil.startContent(ContentEmitterUtil.java:65)
at org.eclipse.birt.report.engine.nLayout.LayoutEngine.visitContent(LayoutEngine.java:713)
at org.eclipse.birt.report.engine.nLayout.LayoutEngine.visitContent(LayoutEngine.java:721)
at org.eclipse.birt.report.engine.nLayout.LayoutEngine.startForeign(LayoutEngine.java:764)
at org.eclipse.birt.report.engine.emitter.ContentEmitterUtil.startContent(ContentEmitterUtil.java:77)
at org.eclipse.birt.report.engine.nLayout.LayoutEngine.visitContent(LayoutEngine.java:713)
at org.eclipse.birt.report.engine.nLayout.LayoutEngine.visitChildren(LayoutEngine.java:737)
at org.eclipse.birt.report.engine.nLayout.RegionLayoutEngine.layout(RegionLayoutEngine.java:31)
at org.eclipse.birt.report.engine.nLayout.area.impl.PageArea.layoutFooter(PageArea.java:489)
at org.eclipse.birt.report.engine.nLayout.area.impl.PageArea.initialize(PageArea.java:249)
at org.eclipse.birt.report.engine.nLayout.area.impl.RootArea.createNewPage(RootArea.java:147)
at org.eclipse.birt.report.engine.nLayout.area.impl.RootArea.initialize(RootArea.java:138)
at org.eclipse.birt.report.engine.nLayout.LayoutEngine.setContainer(LayoutEngine.java:366)
at org.eclipse.birt.report.engine.nLayout.LayoutEngine._startContainer(LayoutEngine.java:454)Finished
</pre>
<p>And my source is:<br>
</p>
<pre class="_prettyXprint _linenums:1">
package org.openxava.datos.actions;
import org.openxava.actions.TabBaseAction;
import java.io.InputStream;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import java.util.logging.Level;
import org.eclipse.birt.core.framework.Platform;
import org.eclipse.birt.report.engine.api.EXCELRenderOption;
import org.eclipse.birt.report.engine.api.EngineConfig;
import org.eclipse.birt.report.engine.api.EngineConstants;
import org.eclipse.birt.report.engine.api.EngineException;
import org.eclipse.birt.report.engine.api.HTMLRenderOption;
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.IRunAndRenderTask;
import org.eclipse.birt.report.engine.api.PDFRenderOption;
import org.eclipse.birt.report.engine.api.impl.*;
public class Imprimir extends TabBaseAction {
@Override
public void execute() throws EngineException {
IRunAndRenderTask task=null;
IReportEngine engine=null;
EngineConfig config = null;
try{
//System.setProperty("java.io.tmpdir", "c:/temp/test/testsampledb");
config = new EngineConfig( );
config.setLogConfig("c:/dwn", Level.INFO);
config.getAppContext().put(EngineConstants.APPCONTEXT_CLASSLOADER_KEY, this.getClass().getClassLoader());
config.getAppContext().put(EngineConstants.WEBAPP_CLASSPATH_KEY, "C:\\Birt\\birt-runtime-4_6_0\\eventjar.jar");
config.setBIRTHome("C:\\Birt\\birt-runtime-4_6_0\\ReportEngine");
//config.setLogConfig(null, Level.FINEST);
Platform.startup( config );
IReportEngineFactory factory = (IReportEngineFactory) Platform
.createFactoryObject( IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );
engine = factory.createReportEngine( config );
IReportRunnable design = null;
//Open the report design
design = engine.openReportDesign("Info.rptdesign");
task = engine.createRunAndRenderTask(design);
//task.setParameterValue("Top Count", (new Integer(5)));
task.validateParameters();
//HTMLRenderOption options = new HTMLRenderOption();
//options.setImageDirectory("./");
//options.setOutputFileName("output/resample/eventhandlerjar.html");
//options.setOutputFormat("html");
PDFRenderOption options = new PDFRenderOption();
options.setOutputFileName("c:/report/topn.pdf");
options.setSupportedImageFormats("PNG;GIF;JPG;BMP;SWF;SVG");
options.setOutputFormat("pdf");
//EXCELRenderOption options = new EXCELRenderOption();
//options.setOutputFormat("xls");
//options.setOutputFileName("output/resample/customers.xls");
//options.setWrappingText(true);
task.setRenderOption(options);
//task.setLocale(new Locale("es", "ES"));
task.run();
task.close();
engine.destroy();
}catch( Exception ex){
ex.printStackTrace();
}
finally
{
if ( !task.getErrors( ).isEmpty( ) )
{
for ( Object e : task.getErrors( ) )
{
( (Exception) e ).printStackTrace( );
}
}
Platform.shutdown( );
System.out.println("Finished");
}
}
}
</pre>
<p>any idea about whats happen??</p>
el_odiado76
<p><span>I realized some tests and this error only occur in PDF, if I put the HTML configuration, work.<br>
But i need pdf....any idea to resolve him ¿?<br>
Thanks for help<br>
Have a good day</span><br>
</p>
el_odiado76
<blockquote class="ipsBlockquote" data-author="Clement Wong" data-cid="147106" data-time="1489532328">
<div>
<p>Here are some examples:</p>
<p><a data-ipb='nomediaparse' href='
http://www.eclipse.org/birt/documentation/integrating/reapi.php'>http://www.eclipse.org/birt/documentation/integrating/reapi.php</a></p>
;
<p><a data-ipb='nomediaparse' href='
http://birtworld.blogspot.com/2010/06/birt-excel-output.html'>http://birtworld.blogspot.com/2010/06/birt-excel-output.html</a></p>
;
<p><a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php?/files/file/282-webinar-archive-using-the-birt-report-engine-apis/'>http://developer.actuate.com/community/forum/index.php?/files/file/282-webinar-archive-using-the-birt-report-engine-apis/</a></p>
;
<p> </p>
<p>Also, the DevShare has a ZIP, and when you extract it under API\API\APIs\src\REAPI, you can find examples for RenderTask and RunAndRenderTask:</p>
<p><a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php?/files/file/870-eclipsecon-2011-api-examples/'>http://developer.actuate.com/community/forum/index.php?/files/file/870-eclipsecon-2011-api-examples/</a></p>
;
</div>
</blockquote>
<p>thanks<br>
I try witch your help and now i have this error (up response)<br>
Can you help me?<br><br>
Thanks for all<br>
Sorry for my bad English</p>