|
|
|
Re: Can BITR be used in standalone Swing application? [message #152253 is a reply to message #152245] |
Mon, 10 April 2006 09:25  |
Eclipse User |
|
|
|
Originally posted by: m.n.com
Sure. Below is some code. We are using PDFViewer to display the app.
It does cost $, but wasn't too bad. If your app is open source there is
a GPL viewer from someone else. You can also use the JRex browser to
view the pdf - it will use Adobe Reader and requires native dlls.
public byte[] getReport(String reportName) throws ReportException {
IReportRunnable runnable;
try {
runnable =
ReportUtil.getEngine().openReportDesign(ReportUtil.getReport Home() +
"/reports/" + reportName + ".rptdesign" );
IRunAndRenderTask task =
ReportUtil.getEngine().createRunAndRenderTask( runnable );
IRenderOption options = new FORenderOption( );
options.setOutputFormat("pdf");
ByteArrayOutputStream out = new ByteArrayOutputStream();
options.setOutputStream(out);
task.setRenderOption( options );
task.run( );
if (out.size() <= 0)
{
throw new ReportException(new Exception());
}
return out.toByteArray();
} catch (EngineException e) {
// TODO Auto-generated catch block
e.printStackTrace();
throw new ReportException(new Exception());
}
}
PDFViewerBean viewerBean = new PDFViewerBean();
viewerBean.loadPDF(new ByteArrayInputStream(getReport(reportName)));
//add the viewer to a JFrame or whatever.
Bao Xiang wrote:
> Hi, Mark
> I'm looking for such a solution. Could you pls give an example?
> Thanks.
>
> Xiang
>
> "Mark" <m@n.com> ??????:e1b41b$tbj$1@utils.eclipse.org...
>
>>Yes, but you will need some way to view the report. More than likely a pdf
>>viewer.
>>
>>johnli wrote:
>>
>>>Can BITR be used in standalone Swing app without application server and
>>>web environment?
>>>
>>>Thanks,
>>>John
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.05654 seconds