Skip to main content



      Home
Home » Archived » BIRT » Generating a BIRT PDF Question
Generating a BIRT PDF Question [message #146103] Mon, 20 March 2006 14:53 Go to next message
Eclipse UserFriend
Originally posted by: cruzd.alum.rpi.edu

I'm using the birt-viewer on my tomcat server as was wondering if there
was a way to generate a pdf file from the BIRT reports i have deployed.
If my report has paramaters that the user can enter will this also work
when generating the pdf file?

Thanks!
Re: Generating a BIRT PDF Question [message #146115 is a reply to message #146103] Mon, 20 March 2006 15:21 Go to previous messageGo to next message
Eclipse UserFriend
To create a pdf instead of html, change the
HTMLRenderOption.OUTPUT_FORMAT_HTML to HTMLRenderOption.OUTPUT_FORMAT_PDF
and then make sure you apply it in the same places you would with an HTML.
The parameters should work exactly the same. If you need more details
please ask.
Re: Generating a BIRT PDF Question [message #146142 is a reply to message #146115] Mon, 20 March 2006 15:51 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cruzd.alum.rpi.edu

Where can i change the render option for the BIRt report? Is there a
selection for that in the BIRT-viewer?
Re: Generating a BIRT PDF Question [message #146151 is a reply to message #146142] Mon, 20 March 2006 15:59 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: vladperl.semanticprogrammer.org

"Darwin Cruz" <cruzd@alum.rpi.edu> wrote in message
news:f2b2a385ba921d44826e64f6fe4780ad$1@www.eclipse.org...
> Where can i change the render option for the BIRt report? Is there a
> selection for that in the BIRT-viewer?

Check out thread: "Problem with print"
Re: Generating a BIRT PDF Question [message #146185 is a reply to message #146142] Mon, 20 March 2006 16:36 Go to previous messageGo to next message
Eclipse UserFriend
The HTMLRenderOption should be set in your java application code. If this
doesn't answer your question, where are you initializing your report from?
Re: Generating a BIRT PDF Question [message #146241 is a reply to message #146142] Mon, 20 March 2006 20:25 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jgould.juniper.net

The old version of the UI used to have a link for this on the report
viewing frame. It looks like it was removed. If you check the source for
ToolbarFragment.jsp there is a string defined there called pdfUrl which
holds a URL to generate a PDF from your report. Adding a simple href in
the jsp to that value will work. Unfortunately, the parameters are lost
from this url.

BTW - To get the pdfUrl to work, first download the latest iText jar from
www.lowagie.com/iText and place it in your WEB-INF\lib directory.
Re: Generating a BIRT PDF Question [message #146539 is a reply to message #146142] Tue, 21 March 2006 10:25 Go to previous messageGo to next message
Eclipse UserFriend
Hi,
Pls check out the usage of BIRT Viewer. Basically, you should use
"__format=pdf" in your URL to get a PDF report.

Frank
"Darwin Cruz" <cruzd@alum.rpi.edu>
??????:f2b2a385ba921d44826e64f6fe4780ad$1@www.eclipse.org...
> Where can i change the render option for the BIRt report? Is there a
> selection for that in the BIRT-viewer?
>
Re: Generating a BIRT PDF Question [message #146592 is a reply to message #146539] Tue, 21 March 2006 12:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jgould.juniper.net

Frank,

Are you using the PDF generation? The parameters also need to be placed
in the URL string. How are you doing this?


Bao Xiang wrote:

> Hi,
> Pls check out the usage of BIRT Viewer. Basically, you should use
> "__format=pdf" in your URL to get a PDF report.

> Frank
> "Darwin Cruz" <cruzd@alum.rpi.edu>
> ??????:f2b2a385ba921d44826e64f6fe4780ad$1@www.eclipse.org...
>> Where can i change the render option for the BIRt report? Is there a
>> selection for that in the BIRT-viewer?
>>
Re: Generating a BIRT PDF Question [message #146599 is a reply to message #146592] Tue, 21 March 2006 14:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cruzd.alum.rpi.edu

I am using

/birt-viewer/run?__report=myreport.rptdesign&__format=pd f

to generate the pdf but i'm not sure how to pass the parameters allong
with it when creating the file.
Re: Generating a BIRT PDF Question [message #146610 is a reply to message #146599] Tue, 21 March 2006 14:46 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sarah.dewar.farrow.com

Include parameters as you would in any URL

&param1=value1&param2=value2&param3=etc......... .


Darwin Cruz wrote:

> I am using

> /birt-viewer/run?__report=myreport.rptdesign&__format=pd f

> to generate the pdf but i'm not sure how to pass the parameters allong
> with it when creating the file.
Re: Generating a BIRT PDF Question [message #146624 is a reply to message #146610] Tue, 21 March 2006 15:18 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jgould.juniper.net

Hi Sarah,

Yes that would work. But, if you're using the Birt Report Viewer J2EE
deployment, how do you get the values of param1 and value1 (etc...)? I
could hard code a long URL string for each report, but that doesn't allow
users to enter parameter values.

So, basically, how can I get the values from the parameter pop-up that are
used to run the html report into a URL string for generating a PDF.

It appears that all of the code for generating a PDF is there and working,
but access has been removed from the Viewer UI.



Sarah Dewar wrote:

> Include parameters as you would in any URL

> &param1=value1&param2=value2&param3=etc......... .


> Darwin Cruz wrote:

>> I am using

>> /birt-viewer/run?__report=myreport.rptdesign&__format=pd f

>> to generate the pdf but i'm not sure how to pass the parameters allong
>> with it when creating the file.
Re: Generating a BIRT PDF Question [message #146982 is a reply to message #146624] Wed, 22 March 2006 08:25 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: praful.ascindia.com

Hi abaile,

I am new comer to BIRT. Earlier I was working with Jasper reports.

I tried with solution for PDF generation from
http://dev.eclipse.org/newslists/news.eclipse.birt/msg07058. html also

http://dev.eclipse.org/newslists/news.eclipse.birt/msg07678. html


My code is as follows:


package com.sungard.cs.report;

import org.eclipse.birt.report.engine.api.EngineConfig;
import org.eclipse.birt.report.engine.api.EngineException;
import org.eclipse.birt.report.engine.api.HTMLCompleteImageHandler;
import org.eclipse.birt.report.engine.api.HTMLEmitterConfig;
import org.eclipse.birt.report.engine.api.HTMLRenderOption;
import org.eclipse.birt.report.engine.api.IReportRunnable;
import org.eclipse.birt.report.engine.api.IRunAndRenderTask;
import org.eclipse.birt.report.engine.api.ReportEngine;

public class BIRT_REPORT_PDF {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub

String format = HTMLRenderOption.OUTPUT_FORMAT_HTML;
EngineConfig config = new EngineConfig();
config.setEngineHome(" F:/eclipse/workspace/Jasper/lib/BIRT_RUN_TIME/birt-runtime-1 _0_1/Report
Engine");
// Get rid of Info Messages, print warning and severe messages in
"address"
config.setLogConfig("F:/eclipse/workspace/Jasper",
java.util.logging.Level.WARNING);
HTMLEmitterConfig hc = new HTMLEmitterConfig();
HTMLCompleteImageHandler imageHandler = new HTMLCompleteImageHandler();
hc.setImageHandler(imageHandler);
config.setEmitterConfiguration(format, hc);
ReportEngine engine = new ReportEngine(config);
String reportToRun =
"F:/eclipse/workspace/Jasper/etc/Equity_Sectors.rptdesign";
IReportRunnable report = null;
try
{
report = engine.openReportDesign(reportToRun);
}
catch(EngineException ee)
{
System.err.println("Report " + reportToRun + " not found!\n");
engine.destroy();
return;
}
IRunAndRenderTask task = engine.createRunAndRenderTask(report);
HTMLRenderOption options = new HTMLRenderOption();
options.setOutputFormat(format);
String output = "F:/eclipse/workspace/Jasper/output/test_121.pdf";
options.setOutputFileName(output);
task.setRenderOption(options);

try
{
task.run();
System.out.println("Created Report " + output + ".\n");
}
catch(EngineException ee1)
{
System.err.println("Report " + reportToRun + " run failed.\n");
System.err.println(ee1.toString());
}
engine.destroy();

}

}


I am getting following Exception:

SEVERE: Report engine can not create pdf emitter.
org.eclipse.birt.report.engine.api.EngineException: Report engine fails to
create extension to handle this request.
at
org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.cre ateContentEmitter(RunAndRenderTask.java:117)
at
org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run (RunAndRenderTask.java:174)
at com.sungard.cs.report.EquityReport.executeReport(EquityRepor t.java:60)
at com.sungard.cs.report.EquityReport.main(EquityReport.java:70 )
Mar 22, 2006 6:00:51 PM
org.eclipse.birt.report.engine.api.impl.RunAndRenderTask run
SEVERE: An error happened while running the report. Cause:
org.eclipse.birt.report.engine.api.EngineException: Report engine fails to
create extension to handle this request.
at
org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.cre ateContentEmitter(RunAndRenderTask.java:117)
at
org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run (RunAndRenderTask.java:174)
at com.sungard.cs.report.EquityReport.executeReport(EquityRepor t.java:60)
at com.sungard.cs.report.EquityReport.main(EquityReport.java:70 )
org.eclipse.birt.report.engine.api.EngineException: Error happened while
running the report
at
org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run (RunAndRenderTask.java:186)
at com.sungard.cs.report.EquityReport.executeReport(EquityRepor t.java:60)
at com.sungard.cs.report.EquityReport.main(EquityReport.java:70 )
Caused by: org.eclipse.birt.report.engine.api.EngineException: Report
engine fails to create extension to handle this request.
at
org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.cre ateContentEmitter(RunAndRenderTask.java:117)
at
org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run (RunAndRenderTask.java:174)
... 2 more


I am using Report Engine version as birt-runtime-1_0_1

What I found is org.eclipse.birt.report.engine.emitter.pdf_1.0.1 is
missing from birt-runtime-1_0_1\Report Engine\plugins folder

So I added org.eclipse.birt.report.engine.emitter.pdf_2.0.1 from other
release.

Please guide me.

Thanks in Advance.
Praful Tank
Re: Generating a BIRT PDF Question [message #147014 is a reply to message #146982] Wed, 22 March 2006 09:04 Go to previous messageGo to next message
Eclipse UserFriend
Hi, Praful Tank
AFAIK, BIRT 1.0.1 uses FOP instead of iText to generate PDF reports.
Hence the emitter should be org.eclipse.birt.report.engine.emitter.fo.

Frank


"PRAFUL TANK" <praful@ascindia.com>
??????:ea520ec41963e4bddc8f59f10ef451c7$1@www.eclipse.org...
> Hi abaile,
>
> I am new comer to BIRT. Earlier I was working with Jasper reports.
>
> I tried with solution for PDF generation from
> http://dev.eclipse.org/newslists/news.eclipse.birt/msg07058. html also
> http://dev.eclipse.org/newslists/news.eclipse.birt/msg07678. html
>
>
> My code is as follows:
>
>
> package com.sungard.cs.report;
>
> import org.eclipse.birt.report.engine.api.EngineConfig;
> import org.eclipse.birt.report.engine.api.EngineException;
> import org.eclipse.birt.report.engine.api.HTMLCompleteImageHandler;
> import org.eclipse.birt.report.engine.api.HTMLEmitterConfig;
> import org.eclipse.birt.report.engine.api.HTMLRenderOption;
> import org.eclipse.birt.report.engine.api.IReportRunnable;
> import org.eclipse.birt.report.engine.api.IRunAndRenderTask;
> import org.eclipse.birt.report.engine.api.ReportEngine;
>
> public class BIRT_REPORT_PDF {
>
> /**
> * @param args
> */
> public static void main(String[] args) {
> // TODO Auto-generated method stub
>
> String format = HTMLRenderOption.OUTPUT_FORMAT_HTML;
> EngineConfig config = new EngineConfig();
> config.setEngineHome(" F:/eclipse/workspace/Jasper/lib/BIRT_RUN_TIME/birt-runtime-1 _0_1/Report
> Engine");
> // Get rid of Info Messages, print warning and severe messages in
> "address"
> config.setLogConfig("F:/eclipse/workspace/Jasper",
> java.util.logging.Level.WARNING);
> HTMLEmitterConfig hc = new HTMLEmitterConfig();
> HTMLCompleteImageHandler imageHandler = new HTMLCompleteImageHandler();
> hc.setImageHandler(imageHandler);
> config.setEmitterConfiguration(format, hc);
> ReportEngine engine = new ReportEngine(config);
> String reportToRun =
> "F:/eclipse/workspace/Jasper/etc/Equity_Sectors.rptdesign";
> IReportRunnable report = null;
> try
> {
> report = engine.openReportDesign(reportToRun);
> }
> catch(EngineException ee)
> {
> System.err.println("Report " + reportToRun + " not found!\n");
> engine.destroy();
> return;
> }
> IRunAndRenderTask task = engine.createRunAndRenderTask(report);
> HTMLRenderOption options = new HTMLRenderOption();
> options.setOutputFormat(format);
> String output = "F:/eclipse/workspace/Jasper/output/test_121.pdf";
> options.setOutputFileName(output);
> task.setRenderOption(options);
>
> try
> {
> task.run();
> System.out.println("Created Report " + output + ".\n");
> }
> catch(EngineException ee1)
> {
> System.err.println("Report " + reportToRun + " run failed.\n");
> System.err.println(ee1.toString());
> }
> engine.destroy();
>
> }
>
> }
>
>
> I am getting following Exception:
>
> SEVERE: Report engine can not create pdf emitter.
> org.eclipse.birt.report.engine.api.EngineException: Report engine fails to
> create extension to handle this request.
> at
> org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.cre ateContentEmitter(RunAndRenderTask.java:117)
> at
> org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run (RunAndRenderTask.java:174)
> at com.sungard.cs.report.EquityReport.executeReport(EquityRepor t.java:60)
> at com.sungard.cs.report.EquityReport.main(EquityReport.java:70 )
> Mar 22, 2006 6:00:51 PM
> org.eclipse.birt.report.engine.api.impl.RunAndRenderTask run
> SEVERE: An error happened while running the report. Cause:
> org.eclipse.birt.report.engine.api.EngineException: Report engine fails to
> create extension to handle this request.
> at
> org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.cre ateContentEmitter(RunAndRenderTask.java:117)
> at
> org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run (RunAndRenderTask.java:174)
> at com.sungard.cs.report.EquityReport.executeReport(EquityRepor t.java:60)
> at com.sungard.cs.report.EquityReport.main(EquityReport.java:70 )
> org.eclipse.birt.report.engine.api.EngineException: Error happened while
> running the report
> at
> org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run (RunAndRenderTask.java:186)
> at com.sungard.cs.report.EquityReport.executeReport(EquityRepor t.java:60)
> at com.sungard.cs.report.EquityReport.main(EquityReport.java:70 )
> Caused by: org.eclipse.birt.report.engine.api.EngineException: Report
> engine fails to create extension to handle this request.
> at
> org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.cre ateContentEmitter(RunAndRenderTask.java:117)
> at
> org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run (RunAndRenderTask.java:174)
> ... 2 more
>
>
> I am using Report Engine version as birt-runtime-1_0_1
>
> What I found is org.eclipse.birt.report.engine.emitter.pdf_1.0.1 is
> missing from birt-runtime-1_0_1\Report Engine\plugins folder
>
> So I added org.eclipse.birt.report.engine.emitter.pdf_2.0.1 from other
> release.
>
> Please guide me.
>
> Thanks in Advance.
> Praful Tank
>
>
Re: Generating a BIRT PDF Question [message #147513 is a reply to message #147014] Thu, 23 March 2006 11:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cruzd.alum.rpi.edu

So aside from the long URL passing the parameters there isn't an easier
way to generate a pdf?
Re: Generating a BIRT PDF Question [message #147536 is a reply to message #147513] Thu, 23 March 2006 13:02 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jgould.juniper.net

Hi Darwin,

I found this and rolled back my Birt deployment to 1.0.1.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=124894

PDF's work great in that version. I may try the upgrade again when this
is resolved in 2.1.

Darwin Cruz wrote:

> So aside from the long URL passing the parameters there isn't an easier
> way to generate a pdf?
Re: Generating a BIRT PDF Question [message #147549 is a reply to message #147536] Thu, 23 March 2006 15:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cruzd.alum.rpi.edu

Unfortunately i can't roll back to an earlier version of the Birt Viewer
because i need to support Firefox 1.5 which earlier versions of BIRT
don't. Thanks for the suggestion though.
Re: Generating a BIRT PDF Question [message #147709 is a reply to message #147549] Thu, 23 March 2006 23:22 Go to previous messageGo to next message
Eclipse UserFriend
Darwin Cruz wrote:
> Unfortunately i can't roll back to an earlier version of the Birt Viewer
> because i need to support Firefox 1.5 which earlier versions of BIRT
> don't. Thanks for the suggestion though.


ToolbarFragment.jsp

<%

String htmlUrl = request.getContextPath( ) + "/run?"

+ ParameterAccessor.getEncodedQueryString( request,
ParameterAccessor.PARAM_FORMAT, ParameterAccessor.PARAM_FORMAT_HTML );

String pdfUrl = request.getContextPath( ) + "/run?"

+ ParameterAccessor.getEncodedQueryString( request,
ParameterAccessor.PARAM_FORMAT, ParameterAccessor.PARAM_FORMAT_PDF );

%>

............................................................

<TD ALIGN='right'>

<A ID="print_html" HREF="<%=htmlUrl%>" TARGET="_blank">

<IMG SRC="images/PrintHTML.gif"

TITLE="<%= Resources.getString( "birt.viewer.toolbar.print" )%>" BORDER="0">

</A>

</TD>

<TD ALIGN='right' width="30px">

<A ID="print_pdf" HREF="<%=pdfUrl%>" TARGET="_blank">

<IMG SRC="images/PrintPDF.gif"

TITLE="<%= Resources.getString( "birt.viewer.toolbar.print" )%>" BORDER="0">

</A>

</TD>

------------------------------------------------------------ ------------

BirtParameterDialog.js

__okPress : function( )

{

if( birtParameterDialog.collect_parameter( ) )

{

birtEventDispatcher.broadcastEvent( birtEvent.__E_CHANGE_PARAMETER );

this.__updatePrintLinks();

this.__l_hide( );

}

},

/**

* Patch for print links update :)

*/

__updatePrintLinks : function()

{

var strParams = "";

if (this.__parameter)

{

for (var i=0; i < this.__parameter.length; i++)

{

strParams += "&" + this.__parameter[i].name + "=";

strParams += this.__parameter[i].value;

}

}

if (this.__cascadingParameter)

{

for (var j=0; j < this.__cascadingParameter.length; j++)

{

for (var k=0; k < this.__cascadingParameter[j].length; k++)

{

strParams += "&" + this.__cascadingParameter[j][k].name + "=";

strParams += this.__cascadingParameter[j][k].value;

}

}

}

strHtmlUrl = $('print_html').href;

strUrlBase = strHtmlUrl.substring(0, strHtmlUrl.indexOf("&"));

$('print_html').href = strUrlBase + strParams + "&__format=html";

$('print_pdf').href = strUrlBase + strParams + "&__format=pdf";

},

------------------------------------------------------------ -------------

inside file BirtToolbar.js comment out: alert( oBtn.name );



After changes you will able to print in pdf and html.
Re: Generating a BIRT PDF Question [message #149132 is a reply to message #147709] Tue, 28 March 2006 16:18 Go to previous message
Eclipse UserFriend
Originally posted by: cruzd.alum.rpi.edu

Thank you very much Vladimir. the PDF is working fine now and passing
parameters.

But i'm running into a scaling problem with the PDF generation. My report
has a graph included and it's appearing fine through the viewer but when i
generate it in the pdf it's scaled down too small. Is there a way to set
the scaling when generating the graph in the pdf?
Previous Topic:So sad to say ...
Next Topic:Possible to reuse a single resultset for a chart and table?
Goto Forum:
  


Current Time: Sun Jun 08 17:12:31 EDT 2025

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

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

Back to the top