Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » PDF reports from webapplication
PDF reports from webapplication [message #49174] Wed, 22 June 2005 13:09 Go to next message
Eclipse UserFriend
Originally posted by: juergen.schwarz.gefasoft.de

Hi,

I built BIRT into my web application and it work generating HTML
reports. But I need PDF format, so I changed to OUTPUT_FORMAT_PDF but I
don't get any output, just a blank screen.
In Eclipse preview, the PDF works.

What's going wrong?

Here's the log:


22.06.2005 15:05:28 org.apache.avalon.framework.logger.Jdk14Logger info
INFO: Using org.apache.xerces.parsers.SAXParser as SAX2 Parser
22.06.2005 15:05:28 org.apache.avalon.framework.logger.Jdk14Logger info
INFO: Using org.apache.xerces.parsers.SAXParser as SAX2 Parser
22.06.2005 15:05:29 org.apache.avalon.framework.logger.Jdk14Logger info
INFO: Using org.apache.xerces.parsers.SAXParser as SAX2 Parser
22.06.2005 15:05:29 org.apache.avalon.framework.logger.Jdk14Logger info
INFO: building formatting object tree
22.06.2005 15:05:29 org.apache.avalon.framework.logger.Jdk14Logger info
INFO: setting up fonts
22.06.2005 15:05:30 org.apache.avalon.framework.logger.Jdk14Logger error
SCHWERWIEGEND: property - "text-transform" is not implemented yet.
22.06.2005 15:05:30 org.apache.avalon.framework.logger.Jdk14Logger error
SCHWERWIEGEND: Error in letter-spacing property value 'normal':
org.apache.fop.fo.expr.PropertyException: No conversion
defined
22.06.2005 15:05:30 org.apache.avalon.framework.logger.Jdk14Logger error
SCHWERWIEGEND: property - "word-spacing" is not implemented yet.
22.06.2005 15:05:30 org.apache.avalon.framework.logger.Jdk14Logger error
SCHWERWIEGEND: property - "text-transform" is not implemented yet.
22.06.2005 15:05:30 org.apache.avalon.framework.logger.Jdk14Logger error
SCHWERWIEGEND: Error in letter-spacing property value 'normal':
org.apache.fop.fo.expr.PropertyException: No conversion
defined
22.06.2005 15:05:30 org.apache.avalon.framework.logger.Jdk14Logger error
SCHWERWIEGEND: property - "word-spacing" is not implemented yet.
22.06.2005 15:05:30 org.apache.avalon.framework.logger.Jdk14Logger error
SCHWERWIEGEND: Error in column-width property value '20%':
org.apache.fop.fo.expr.PropertyException: No conversion defin
ed
22.06.2005 15:05:30 org.apache.avalon.framework.logger.Jdk14Logger error
SCHWERWIEGEND: Error in column-width property value '30%':
org.apache.fop.fo.expr.PropertyException: No conversion defin
ed
22.06.2005 15:05:30 org.apache.avalon.framework.logger.Jdk14Logger error
SCHWERWIEGEND: Error in column-width property value '20%':
org.apache.fop.fo.expr.PropertyException: No conversion defin
ed
22.06.2005 15:05:30 org.apache.avalon.framework.logger.Jdk14Logger error
SCHWERWIEGEND: Error in column-width property value '30%':
org.apache.fop.fo.expr.PropertyException: No conversion defin
ed
22.06.2005 15:05:30 org.apache.avalon.framework.logger.Jdk14Logger info
INFO: [1]
22.06.2005 15:05:30 org.apache.avalon.framework.logger.Jdk14Logger error
SCHWERWIEGEND: At least one of minimum, optimum, or maximum IPD must be
specified on table.
22.06.2005 15:05:30 org.apache.avalon.framework.logger.Jdk14Logger error
SCHWERWIEGEND: At least one of minimum, optimum, or maximum IPD must be
specified on table.
22.06.2005 15:05:30 org.apache.avalon.framework.logger.Jdk14Logger info
INFO: area contents overflows area in line Beschreibung
22.06.2005 15:05:30 org.apache.avalon.framework.logger.Jdk14Logger info
INFO: area contents overflows area in line Typattribut?
22.06.2005 15:05:30 org.apache.avalon.framework.logger.Jdk14Logger error
SCHWERWIEGEND: At least one of minimum, optimum, or maximum IPD must be
specified on table.
22.06.2005 15:05:30 org.apache.avalon.framework.logger.Jdk14Logger info
INFO: Parsing of document complete, stopping renderer
22.06.2005 15:05:30 org.eclipse.birt.data.engine.impl.DataEngineImpl
shutdown
INFO: Data engine shuts down
Re: PDF reports from webapplication [message #49197 is a reply to message #49174] Wed, 22 June 2005 13:18 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: juergen.schwarz.gefasoft.de

Oh, I can see a .fo file in the temp directory but I get no PDF...
Re: PDF reports from webapplication [message #51674 is a reply to message #49197] Mon, 27 June 2005 16:56 Go to previous messageGo to next message
Stanley Wang is currently offline Stanley WangFriend
Messages: 81
Registered: July 2009
Member
Do you at least see a PDF file?

Can you log a bugzilla entry with the report attached? If your report uses
special data sources, can you make sure to reproduce it with a
self-contained data source?

Stanley Wang
Re: PDF reports from webapplication [message #52113 is a reply to message #51674] Tue, 28 June 2005 11:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: juergen.schwarz.gefasoft.de

The strange thing is that from the delivered ViewerServlet it works, but
I can't find any real difference to my code.
So I think it's not a BIRT problem.


Stanley Wang schrieb:
> Do you at least see a PDF file?
> Can you log a bugzilla entry with the report attached? If your report
> uses special data sources, can you make sure to reproduce it with a
> self-contained data source?
>
> Stanley Wang
>
Re: PDF reports from webapplication [message #52167 is a reply to message #52113] Tue, 28 June 2005 13:39 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: adam.adam.com

Juergen,
you think you can show me how you got the html to display on the
webapp. My jsp script runs and generates and output file but there is
nothing on the screen. If you can point me in the right direction I would
greatly appreciate it. Thanks
Re: PDF reports from webapplication [message #52191 is a reply to message #52167] Tue, 28 June 2005 13:45 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: juergen.schwarz.gefasoft.de

Adam schrieb:
> Juergen,
> you think you can show me how you got the html to display on the
> webapp. My jsp script runs and generates and output file but there is
> nothing on the screen. If you can point me in the right direction I
> would greatly appreciate it. Thanks
>

Hi Adam,

This is more or less code I copied from the ViewerServlet. It works with HTML but not with PDF:

<<<< cut here

/**
* Process incoming HTTP GET requests
*
* @param request Object that encapsulates the request to the servlet
* @param response Object that encapsulates the response from the servlet
*/
public void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException {
PTIdentListData listData=null;

/*** Test BIRT **/
System.err.println("Start BIRT test...");
try {
EngineConfig config=new EngineConfig();
config.setEngineHome(getServletContext( ).getRealPath("")+"/birtreport");
ReportEngine engine=new ReportEngine(config);

IReportRunnable report = engine.openReportDesign(getServletContext( ).getRealPath("/birtreport/jsloc.rptdesign"));

// Render options:
IRenderOption option = new HTMLRenderOption( );
ServletOutputStream servletOutputStream = response.getOutputStream( );
option.setOutputStream( servletOutputStream );
option.setOutputFormat(HTMLRenderOption.OUTPUT_FORMAT_PDF);


// Run task
IRunAndRenderTask runTask = engine.createRunAndRenderTask( report );
HashMap params=new HashMap();
params.put("paramPartId",new Integer(1730)); // part ID of part to display
runTask.setParameterValues(params);
runTask.setRenderOption( option );

/** PDF:
response.setContentType( "application/pdf" );
*/

/** HTML: **/
// Render context
response.setContentType( "text/html;charset=utf-8" );
response.setHeader( "cache-control", "no-cache" );
HTMLRenderContext renderContext = new HTMLRenderContext( );
renderContext.setImageDirectory(getServletContext( ).getRealPath( "/birtreport/images" ));
renderContext.setBaseImageURL( request.getContextPath( ) + "/birtreport/images");
runTask.setContext( renderContext );
/*** **/
runTask.run( );
servletOutputStream.flush();
servletOutputStream.close();
return;
}
catch(Throwable e) {
System.err.println("BIRT Exception: "+e.toString());
e.printStackTrace();
}

System.err.println("End BIRT test...");
<<<< cut here
Re: PDF reports from webapplication [message #52240 is a reply to message #52191] Tue, 28 June 2005 14:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: adam.adam.com

Thanks for the code to help out. I am using java and I looked at all the
manuels and it looks like i am doing it right. The only thing is, is that
nothing displays on the webapp. I know that it runs since i have been
debuggin it and it is running all the way. Here is my code. If you can
see anything wrong please let me know. Remember i am running it from a
jsp script.

EngineConfig conf = new EngineConfig();
String home = "C:\\WWW\\Tomcat 5.5\\webapps\\birt\\WEB-INF";
conf.setEngineHome(home);

HTMLEmitterConfig hc = new HTMLEmitterConfig();
HTMLCompleteImageHandler imageHandler = new HTMLCompleteImageHandler();
hc.setImageHandler(imageHandler);
conf.setEmitterConfiguration(HTMLRenderOption.OUTPUT_FORMAT_ HTML, hc);

ReportEngine rengine = new ReportEngine(null);
String fileName = "C:\\WWW\\Tomcat
5.5\\webapps\\birt\\reports\\report1.rptdesign";
IReportRunnable report = null;
try{
report = rengine.openReportDesign(fileName);
} catch (EngineException e){
out.println(e);
rengine.destroy();
return;
}


IRunAndRenderTask task = rengine.createRunAndRenderTask(report);
HTMLRenderOption option = new HTMLRenderOption();
option.setOutputFormat(HTMLRenderOption.OUTPUT_FORMAT_HTML);
option.setOutputFileName("c:/temp/sample.html");
task.setRenderOption(option);



try{
task.run();
out.println("Created Report ");
} catch(EngineException e){
out.println("Report" + fileName + "failed");
out.println(e);
}
Re: PDF reports from webapplication [message #52266 is a reply to message #52240] Tue, 28 June 2005 14:25 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: juergen.schwarz.gefasoft.de

It seems that you try to output the HTML in a file ("c:/temp/sample.html") instead of giwing it back from the jsp.
I have no experience with jsp but you should try to send it to the OutputStream, something like that (which is from a Servlet):

ServletOutputStream servletOutputStream = response.getOutputStream( );
option.setOutputStream( servletOutputStream );

But I don't know how to get the output stream from within a jsp script.



Adam schrieb:
> Thanks for the code to help out. I am using java and I looked at all
> the manuels and it looks like i am doing it right. The only thing is,
> is that nothing displays on the webapp. I know that it runs since i
> have been debuggin it and it is running all the way. Here is my code.
> If you can see anything wrong please let me know. Remember i am running
> it from a jsp script.
> EngineConfig conf = new EngineConfig();
> String home = "C:\\WWW\\Tomcat 5.5\\webapps\\birt\\WEB-INF";
> conf.setEngineHome(home);
>
> HTMLEmitterConfig hc = new HTMLEmitterConfig();
> HTMLCompleteImageHandler imageHandler = new HTMLCompleteImageHandler();
> hc.setImageHandler(imageHandler);
> conf.setEmitterConfiguration(HTMLRenderOption.OUTPUT_FORMAT_ HTML, hc);
>
> ReportEngine rengine = new ReportEngine(null);
> String fileName = "C:\\WWW\\Tomcat
> 5.5\\webapps\\birt\\reports\\report1.rptdesign";
> IReportRunnable report = null;
> try{
> report = rengine.openReportDesign(fileName);
> } catch (EngineException e){
> out.println(e);
> rengine.destroy();
> return;
> }
>
>
> IRunAndRenderTask task = rengine.createRunAndRenderTask(report);
> HTMLRenderOption option = new HTMLRenderOption();
> option.setOutputFormat(HTMLRenderOption.OUTPUT_FORMAT_HTML);
> option.setOutputFileName("c:/temp/sample.html");
> task.setRenderOption(option);
>
>
>
> try{
> task.run();
> out.println("Created Report ");
> } catch(EngineException e){
> out.println("Report" + fileName + "failed");
> out.println(e);
> }
>
Re: PDF reports from webapplication [message #52320 is a reply to message #52266] Tue, 28 June 2005 14:55 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: adam.adam.com

Thanks for helping me out so far. What you described seems to be my
option.setOutputFormat(HTMLRenderOption.OUTPUT_FORMAT_HTML); part. my
option.setOutputFile works perfectly fine b/c i get an output file with
what the rptdesign documents looks like. I am still troubleshooting but
any suggestions would be of help. Thanks
Re: PDF reports from webapplication [message #52372 is a reply to message #52320] Tue, 28 June 2005 15:45 Go to previous messageGo to next message
Stanley Wang is currently offline Stanley WangFriend
Messages: 81
Registered: July 2009
Member
Adam,

From the several emails you have posted, I assume you are trying to use
report engine in JSP page to display the output in a browser, but you
see nothing in the browser. However, you did see an HTML file generated
on disk, right?

If that is the case, you do need to pass your JSP output stream to the
engine for it to generate output to. That is what the function
setOutputStream is for (as compared to setOutputFileName).

There is a Viewer web-application shipped with BIRT. Please check out
that applicaiton for further details. That app is directly deployable.

Stanley Wang
BIRT Engine

Adam wrote:
> Thanks for helping me out so far. What you described seems to be my
> option.setOutputFormat(HTMLRenderOption.OUTPUT_FORMAT_HTML); part. my
> option.setOutputFile works perfectly fine b/c i get an output file with
> what the rptdesign documents looks like. I am still troubleshooting but
> any suggestions would be of help. Thanks
>
Re: PDF reports from webapplication [message #52489 is a reply to message #52372] Tue, 28 June 2005 17:56 Go to previous message
Eclipse UserFriend
Originally posted by: adam.adam.com

Stanley,
Thanks for the response. I have been looking at the
setOutputStream method but I am not getting very far with it.
setOutputStream takes in parameters (OutputStream ostream). This is where
i am lost. Could you explain from my code earlier what else i have to put
in. Thanks. I will be continuing to look at it.
Previous Topic:Parameters - Script
Next Topic:Group By and Aggregate functions possible in SQL?
Goto Forum:
  


Current Time: Sun Oct 06 08:35:04 GMT 2024

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

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

Back to the top