Skip to main content



      Home
Home » Archived » BIRT » How to save report to excel or pdf silently in server or client PC
How to save report to excel or pdf silently in server or client PC [message #722571] Tue, 06 September 2011 04:24 Go to next message
Eclipse UserFriend
Hi all,
Is there a way to save or export report to pdf or excel silently in server or client PC?

Thanks
Re: How to save report to excel or pdf silently in server or client PC [message #722710 is a reply to message #722571] Tue, 06 September 2011 10:38 Go to previous messageGo to next message
Eclipse UserFriend
Can you give some more detail? Do you want as a user views the report
in html the server to generate a pdf copy somewhere?

Jason

On 9/6/2011 4:24 AM, cbr125x wrote:
> Hi all,
> Is there a way to save or export report to pdf or excel silently in
> server or client PC?
>
> Thanks
Re: How to save report to excel or pdf silently in server or client PC [message #722861 is a reply to message #722710] Tue, 06 September 2011 21:28 Go to previous messageGo to next message
Eclipse UserFriend
Thanks Jason for reply,
yes, i want to generate the report that i made by BIRT into PDF file, and save the file in the server local drive or client local drive (which i already granted permission to write).
Let's say i want to generate the report in pdf file at C:\PDF\ or at \\server1\PDF\
is there a way to do that?



Jason Weathersby wrote on Tue, 06 September 2011 10:38
Can you give some more detail? Do you want as a user views the report
in html the server to generate a pdf copy somewhere?

Jason

On 9/6/2011 4:24 AM, cbr125x wrote:
> Hi all,
> Is there a way to save or export report to pdf or excel silently in
> server or client PC?
>
> Thanks

Re: How to save report to excel or pdf silently in server or client PC [message #723540 is a reply to message #722861] Thu, 08 September 2011 14:39 Go to previous messageGo to next message
Eclipse UserFriend
Are you using the RE API or the BIRT Viewer?

Jason

On 9/6/2011 9:28 PM, cbr125x wrote:
> Thanks Jason for reply,
> yes, i want to generate the report that i made by BIRT into PDF file,
> and save the file in the server local drive or client local drive (which
> i already granted permission to write).
> Let's say i want to generate the report in pdf file at C:\PDF\ or at
> \\server1\PDF\
> is there a way to do that?
>
>
>
> Jason Weathersby wrote on Tue, 06 September 2011 10:38
>> Can you give some more detail? Do you want as a user views the report
>> in html the server to generate a pdf copy somewhere?
>>
>> Jason
>>
>> On 9/6/2011 4:24 AM, cbr125x wrote:
>> > Hi all,
>> > Is there a way to save or export report to pdf or excel silently in
>> > server or client PC?
>> >
>> > Thanks
>
>
Re: How to save report to excel or pdf silently in server or client PC [message #723620 is a reply to message #723540] Thu, 08 September 2011 21:23 Go to previous messageGo to next message
Eclipse UserFriend
actually i'm not really sure what method i use, i think it is BIRT Viewer, i put the "webviewerExample" in the tomcat server, is it Viewer?

can i you explain me too about the RE API?

Thanks

Jason Weathersby wrote on Thu, 08 September 2011 14:39
Are you using the RE API or the BIRT Viewer?

Jason

On 9/6/2011 9:28 PM, cbr125x wrote:
> Thanks Jason for reply,
> yes, i want to generate the report that i made by BIRT into PDF file,
> and save the file in the server local drive or client local drive (which
> i already granted permission to write).
> Let's say i want to generate the report in pdf file at C:\PDF\ or at
> \\server1\PDF\
> is there a way to do that?
>
>
>
> Jason Weathersby wrote on Tue, 06 September 2011 10:38
>> Can you give some more detail? Do you want as a user views the report
>> in html the server to generate a pdf copy somewhere?
>>
>> Jason
>>
>> On 9/6/2011 4:24 AM, cbr125x wrote:
>> > Hi all,
>> > Is there a way to save or export report to pdf or excel silently in
>> > server or client PC?
>> >
>> > Thanks
>
>

Re: How to save report to excel or pdf silently in server or client PC [message #724557 is a reply to message #723620] Mon, 12 September 2011 10:16 Go to previous messageGo to next message
Eclipse UserFriend
That is the viewer. You could write some script in the report that
would save the report to the server in a different format while the user
is viewing it in HTML. Is that what you want?

Jason

On 9/8/2011 9:23 PM, cbr125x wrote:
> actually i'm not really sure what method i use, i think it is BIRT
> Viewer, i put the "webviewerExample" in the tomcat server, is it Viewer?
>
> can i you explain me too about the RE API?
>
> Thanks
>
> Jason Weathersby wrote on Thu, 08 September 2011 14:39
>> Are you using the RE API or the BIRT Viewer?
>>
>> Jason
>>
>> On 9/6/2011 9:28 PM, cbr125x wrote:
>> > Thanks Jason for reply,
>> > yes, i want to generate the report that i made by BIRT into PDF file,
>> > and save the file in the server local drive or client local drive
>> (which
>> > i already granted permission to write).
>> > Let's say i want to generate the report in pdf file at C:\PDF\ or at
>> > \\server1\PDF\
>> > is there a way to do that?
>> >
>> >
>> >
>> > Jason Weathersby wrote on Tue, 06 September 2011 10:38
>> >> Can you give some more detail? Do you want as a user views the report
>> >> in html the server to generate a pdf copy somewhere?
>> >>
>> >> Jason
>> >>
>> >> On 9/6/2011 4:24 AM, cbr125x wrote:
>> >> > Hi all,
>> >> > Is there a way to save or export report to pdf or excel silently in
>> >> > server or client PC?
>> >> >
>> >> > Thanks
>> >
>> >
>
>
Re: How to save report to excel or pdf silently in server or client PC [message #724731 is a reply to message #724557] Mon, 12 September 2011 21:27 Go to previous messageGo to next message
Eclipse UserFriend
Yes, that is what i want, what script i should write?

Jason Weathersby wrote on Mon, 12 September 2011 10:16 :
That is the viewer. You could write some script in the report that
would save the report to the server in a different format while the user
is viewing it in HTML. Is that what you want?

Jason

On 9/8/2011 9:23 PM, cbr125x wrote:
> actually i'm not really sure what method i use, i think it is BIRT
> Viewer, i put the "webviewerExample" in the tomcat server, is it Viewer?
>
> can i you explain me too about the RE API?
>
> Thanks
>
> Jason Weathersby wrote on Thu, 08 September 2011 14:39
>> Are you using the RE API or the BIRT Viewer?
>>
>> Jason
>>
>> On 9/6/2011 9:28 PM, cbr125x wrote:
>> > Thanks Jason for reply,
>> > yes, i want to generate the report that i made by BIRT into PDF file,
>> > and save the file in the server local drive or client local drive
>> (which
>> > i already granted permission to write).
>> > Let's say i want to generate the report in pdf file at C:\PDF\ or at
>> > \\server1\PDF\
>> > is there a way to do that?
>> >
>> >
>> >
>> > Jason Weathersby wrote on Tue, 06 September 2011 10:38
>> >> Can you give some more detail? Do you want as a user views the report
>> >> in html the server to generate a pdf copy somewhere?
>> >>
>> >> Jason
>> >>
>> >> On 9/6/2011 4:24 AM, cbr125x wrote:
>> >> > Hi all,
>> >> > Is there a way to save or export report to pdf or excel silently in
>> >> > server or client PC?
>> >> >
>> >> > Thanks
>> >
>> >
>
>
Re: How to save report to excel or pdf silently in server or client PC [message #725008 is a reply to message #724731] Tue, 13 September 2011 13:52 Go to previous messageGo to next message
Eclipse UserFriend
I am attaching an example of a report that creates a pdf for every row
in a detail table. Look at the table row oncreate to get an idea on how
to call the api from script. In your case you can put the script in the
afterFactory of the report.

Jason

On 9/12/2011 9:27 PM, cbr125x wrote:
> Yes, that is what i want, what script i should write?
>
> Jason Weathersby wrote on Mon, 12 September 2011 10:16 :
> That is the viewer. You could write some script in the report that would
> save the report to the server in a different format while the user is
> viewing it in HTML. Is that what you want?
>
> Jason
>
> On 9/8/2011 9:23 PM, cbr125x wrote:
>> actually i'm not really sure what method i use, i think it is BIRT
>> Viewer, i put the "webviewerExample" in the tomcat server, is it Viewer?
>>
>> can i you explain me too about the RE API?
>>
>> Thanks
>>
>> Jason Weathersby wrote on Thu, 08 September 2011 14:39
>>> Are you using the RE API or the BIRT Viewer?
>>>
>>> Jason
>>>
>>> On 9/6/2011 9:28 PM, cbr125x wrote:
>>> > Thanks Jason for reply,
>>> > yes, i want to generate the report that i made by BIRT into PDF file,
>>> > and save the file in the server local drive or client local drive
>>> (which
>>> > i already granted permission to write).
>>> > Let's say i want to generate the report in pdf file at C:\PDF\ or at
>>> > \\server1\PDF\
>>> > is there a way to do that?
>>> >
>>> >
>>> >
>>> > Jason Weathersby wrote on Tue, 06 September 2011 10:38
>>> >> Can you give some more detail? Do you want as a user views the report
>>> >> in html the server to generate a pdf copy somewhere?
>>> >>
>>> >> Jason
>>> >>
>>> >> On 9/6/2011 4:24 AM, cbr125x wrote:
>>> >> > Hi all,
>>> >> > Is there a way to save or export report to pdf or excel silently in
>>> >> > server or client PC?
>>> >> >
>>> >> > Thanks
>>> >
>>> >
>>
>>
>
  • Attachment: burst.zip
    (Size: 5.53KB, Downloaded 1177 times)
Re: How to save report to excel or pdf silently in server or client PC [message #725173 is a reply to message #725008] Wed, 14 September 2011 03:02 Go to previous messageGo to next message
Eclipse UserFriend
Thx Jason for keep replying my question.
i already test the example u gave me. it generate pdf successfuly.
but i did not succeed implement the script in my report.
i try to describe the example u gave, sorry if i was wrong.

in the report it seeems we have to report "burstpdf" and "burstDetail".
when we called the "burstpdf" report then we generate the "burstDetail" report to pdf into "c:temp".
how about if i want to generate the burstpdf only?

i try to put this script in the afterFactory Events in report design
importPackage(Packages.org.eclipse.birt.report.engine.api);
var re = reportContext.getReportRunnable().getReportEngine();
var des = re.openReportDesign("C:/Testing/ABC.rptdesign"); //--> Let's say i have ABC.rptdesign
var ntask = re.createRunAndRenderTask(des);
var options = new PDFRenderOption();
var outputfile = "c:/temp/test1.pdf";
options.setOutputFileName(outputfile);
options.setOutputFormat("pdf");
ntask.setRenderOption(options);
ntask.run();
ntask.close();

the viewer become not responding. but when i comment the
//ntask.run();
//ntask.close();

The report run successfuly but the pdf is still not created.

can u help me in which script i must change?
Thx Again

Jason Weathersby wrote on Tue, 13 September 2011 13:52
I am attaching an example of a report that creates a pdf for every row
in a detail table. Look at the table row oncreate to get an idea on how
to call the api from script. In your case you can put the script in the
afterFactory of the report.

Jason

[Updated on: Wed, 14 September 2011 03:03] by Moderator

Re: How to save report to excel or pdf silently in server or client PC [message #725382 is a reply to message #725173] Wed, 14 September 2011 11:25 Go to previous messageGo to next message
Eclipse UserFriend
My guess is that you have a nested chase condition. You are calling a
report that generates a pdf which in itself is generating another pdf
and on and on and on..

Look at the attached example where I use a hidden parameter to make sure
this does not happen. BTW I just did the pdf generation in the
beforeFactory.

Jason

On 9/14/2011 3:02 AM, cbr125x wrote:
> importPackage(Packages.org.eclipse.birt.report.engine.api);
> var re = reportContext.getReportRunnable().getReportEngine();
> var des = re.openReportDesign("C:/Testing/ABC.rptdesign"); var ntask =
> re.createRunAndRenderTask(des);
> var options = new PDFRenderOption();
> var outputfile = "c:/temp/test1.pdf";
> options.setOutputFileName(outputfile);
> options.setOutputFormat("pdf");
> ntask.setRenderOption(options);
> ntask.run();
> ntask.close();
Re: How to save report to excel or pdf silently in server or client PC [message #725508 is a reply to message #725382] Wed, 14 September 2011 22:07 Go to previous messageGo to next message
Eclipse UserFriend
thx Jason it works now. but i have some questions.
1. I tried not to use the parameter, PDF file is generated but it takes long time than we use parameter. why should we use parameter?
2. what is the different with after factory and before factory?



Jason Weathersby wrote on Wed, 14 September 2011 11:25
My guess is that you have a nested chase condition. You are calling a
report that generates a pdf which in itself is generating another pdf
and on and on and on..

Look at the attached example where I use a hidden parameter to make sure
this does not happen. BTW I just did the pdf generation in the
beforeFactory.

Jason

On 9/14/2011 3:02 AM, cbr125x wrote:
> importPackage(Packages.org.eclipse.birt.report.engine.api);
> var re = reportContext.getReportRunnable().getReportEngine();
> var des = re.openReportDesign("C:/Testing/ABC.rptdesign"); var ntask =
> re.createRunAndRenderTask(des);
> var options = new PDFRenderOption();
> var outputfile = "c:/temp/test1.pdf";
> options.setOutputFileName(outputfile);
> options.setOutputFormat("pdf");
> ntask.setRenderOption(options);
> ntask.run();
> ntask.close();

Re: How to save report to excel or pdf silently in server or client PC [message #725677 is a reply to message #725508] Thu, 15 September 2011 09:46 Go to previous messageGo to next message
Eclipse UserFriend
It does not matter if you do it in the beforeFactory or afterFactory.
The reason it is taking longer without the parameter is it is trying to
run the report a bunch of times. Every time you call the report it will
create the pdf which is circular logic.

Jason

On 9/14/2011 10:07 PM, cbr125x wrote:
> thx Jason it works now. but i have some questions. 1. I tried not to use
> the parameter, PDF file is generated but it takes long time than we use
> parameter. why should we use parameter?
> 2. what is the different with after factory and before factory?
>
>
>
> Jason Weathersby wrote on Wed, 14 September 2011 11:25
>> My guess is that you have a nested chase condition. You are calling a
>> report that generates a pdf which in itself is generating another pdf
>> and on and on and on..
>>
>> Look at the attached example where I use a hidden parameter to make
>> sure this does not happen. BTW I just did the pdf generation in the
>> beforeFactory.
>>
>> Jason
>>
>> On 9/14/2011 3:02 AM, cbr125x wrote:
>> > importPackage(Packages.org.eclipse.birt.report.engine.api);
>> > var re = reportContext.getReportRunnable().getReportEngine();
>> > var des = re.openReportDesign("C:/Testing/ABC.rptdesign"); var ntask =
>> > re.createRunAndRenderTask(des);
>> > var options = new PDFRenderOption();
>> > var outputfile = "c:/temp/test1.pdf";
>> > options.setOutputFileName(outputfile);
>> > options.setOutputFormat("pdf");
>> > ntask.setRenderOption(options);
>> > ntask.run();
>> > ntask.close();
>
>
Re: How to save report to excel or pdf silently in server or client PC [message #1064752 is a reply to message #725677] Thu, 20 June 2013 16:02 Go to previous messageGo to next message
Eclipse UserFriend
Hi Jason,

I used the following code to save the birt report as a PDF in Java.
I'm able to save the pdf file. But, I cannot delete the file because it is still in use. Do you know any workaround for this?

IReportDocument rptDoc = engine.openReportDocument(docname);
IRenderTask renderTask = engine.createRenderTask(rptDoc);
RenderOption options = new PDFRenderOption();
options.setOutputFormat("pdf");
File tempReportFile = new File(filename);
String tempReportCanonicalPath = tempReportFile.getCanonicalPath();
options.setOutputFileName(tempReportCanonicalPath);
renderTask.setRenderOption(options);
renderTask.render();
renderTask.close();
rptDoc.close();
reportDesignHandle.close();
//Some processing is done here (but no file handles opened)

//Never able to delete the file because it is in use by some BIRT Class (I think)
if(tempReportFile.delete()) {
logger.debug("delete success");
}
else {
logger.debug("delete fail");
}
Re: How to save report to excel or pdf silently in server or client PC [message #1727778 is a reply to message #1064752] Sun, 27 March 2016 07:32 Go to previous messageGo to next message
Eclipse UserFriend
Hi jason,
In the way you showed i am able to create pdf files for static reports. but what about dynamic reports? I mean i am using pojo data source provided in birt and generating a report from rptdesign file. in the rptdesign file i tried copying the same code written by you but i does not work.

I want to generate the pdf file for the viewing report which is generated by pojo datasource using the data from the database. can you help me in this?
Re: How to save report to excel or pdf silently in server or client PC [message #1747974 is a reply to message #722571] Thu, 17 November 2016 06:24 Go to previous messageGo to next message
Eclipse UserFriend
hi iam unable to convert my rptdesign file to pdf anybody please help ..
below is the code i am working on :
try {
EngineConfig config = new EngineConfig();

Platform.startup(config);

ReportEngine engine = new ReportEngine(config);

IReportRunnable reportRunnable = engine.openReportDesign(reportDesign);
IRunAndRenderTask runAndRender = engine.createRunAndRenderTask(reportRunnable);

PDFRenderOption option = new PDFRenderOption();
option.setOutputFileName("C:/Users/chabbbpa/Desktop/WebViewerExample/check.pdf");
option.setOutputFormat("PDF");
runAndRender.setRenderOption(option);

runAndRender.run();
System.out.println("report generated");
runAndRender.close();
engine.destroy();
Platform.shutdown();
} catch (EngineException e) {
e.printStackTrace();
} catch (BirtException e) {
e.printStackTrace();
}
Re: How to save report to excel or pdf silently in server or client PC [message #1771810 is a reply to message #725508] Wed, 30 August 2017 14:56 Go to previous messageGo to next message
Eclipse UserFriend
Hi
your Example report CreatePDFversion is working for no parameters But i have to pass parameters.
But in my Report i have many parameters which are passed to the Report.
It shows 27 pages data, but the file in C;/temp/testa.pdf shows no data.
Why ? Is additional code required for paramterized Report to pass those paramters to the PDF too.

Can you please modify your code in Before Factory to include the parameters value passed to the Report design in your code. i.e.

if( params["createPDF"] == true ){

importPackage(Packages.org.eclipse.birt.report.engine.api);
var re = reportContext.getReportRunnable().getReportEngine();
var des = re.openReportDesign("C:\\work\\workspaces\\2.6.1workspaces\\BIRT - Reports\\BirtEventHandlersReports\\book\\script\\burst\\createpdfversion.rptdesign");

var ntask = re.createRunAndRenderTask(des);
ntask.setParameterValue("createPDF", false);
var options = new PDFRenderOption();
var outputfile = "C:/Temp/testa.pdf";
options.setOutputFileName(outputfile);
options.setOutputFormat("pdf");
ntask.setRenderOption(options);
ntask.run();
ntask.close();

}


[Updated on: Wed, 30 August 2017 16:54] by Moderator

Re: How to save report to excel or pdf silently in server or client PC [message #1771871 is a reply to message #725382] Thu, 31 August 2017 10:09 Go to previous messageGo to next message
Eclipse UserFriend
Hi Jason

Can you please create similar report createpdfversion which has parameters too. as for me the Report with parameters is showing Blank data though Report in BIRT viewer has data.

I suppose the parameters are not passed onto this PDF.

Please help i am novice in this.
Thanks
Re: How to save report to excel or pdf silently in server or client PC [message #1771891 is a reply to message #725508] Thu, 31 August 2017 13:16 Go to previous messageGo to next message
Eclipse UserFriend
hi Jason
Your work is appreciated.
Please help us with an example for createpdfversion with paramters.
As this is without any paramters.
Thanks
Raj
Re: How to save report to excel or pdf silently in server or client PC [message #1785894 is a reply to message #1771871] Sun, 22 April 2018 12:43 Go to previous messageGo to next message
Eclipse UserFriend
Did u got result for this? I am also expecting result for the same question
Re: How to save report to excel or pdf silently in server or client PC [message #1818701 is a reply to message #1771891] Mon, 23 December 2019 21:58 Go to previous message
Eclipse UserFriend
Hi
You can set parameters as
ntask.setParameterValue(paramaterName, parameterValue);

Example -
importPackage(Packages.org.eclipse.birt.report.engine.api);
var re = reportContext.getReportRunnable().getReportEngine();
var des = re.openReportDesign("D:\\Projects\\BirtReport\\BirtReport\\test\\Agent_Details_Report.rptdesign");
var ntask = re.createRunAndRenderTask(des);

//set paameters
ntask.setParameterValue("dob", params["dob"].value);
ntask.setParameterValue("agentCode", params["agentCode"].value);

var options = new PDFRenderOption();
var outputfile = "d:/birt_pdf/testAgent.pdf";
options.setOutputFileName(outputfile);
options.setOutputFormat("pdf");
ntask.setRenderOption(options);
ntask.run();
ntask.close();

Thanks,
Tejaswini
Previous Topic:Need help to disable multi-sheet export in XLSX format
Next Topic:Adding Column to Table
Goto Forum:
  


Current Time: Tue Jul 22 19:33:51 EDT 2025

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

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

Back to the top