Home
Analytics
Displaying BIRT report in PDF format
sjpondiong
Hello...
I am a newbie with BIRT and it is my first time using any reporting tool frameworks so please bear with me.
I am implementing BIRT report for an application I am asked to develop. Anyway, I can already display the report in HTML format, but I want to display in PDF format.
I have read a lot of resources in the web and some are confusing.
So my questions are:
- In transforming my BIRT report to PDF, do I really need to use iText for it?
- what about the HTMLRenderOption.OUTPUT_FORMAT_PDF... does it work?
- any easier method?
Any help would be greatly appreciated. Thanks.
Find more posts tagged with
Comments
mwilliams
Hi sjpondiong,
Are you deploying the viewer to render the reports or are you doing the displaying of the reports in a custom way within your application? If you're using the viewer, you should just be able to specify the format in the URL with the below URL parameter.
__format=pdf
sjpondiong
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="67586" data-time="1282322099" data-date="20 August 2010 - 09:34 AM"><p>
Hi sjpondiong,<br />
<br />
Are you deploying the viewer to render the reports or are you doing the displaying of the reports in a custom way within your application? If you're using the viewer, you should just be able to specify the format in the URL with the below URL parameter.<br />
<br />
__format=pdf<br /></p></blockquote>
<br />
Hello, sorry for the late reply... had some problems remembering my account details here...<br />
<br />
Anyway, to answer your question, no I am not using a viewer... What I am developing is actually a web application.<br />
I want to be able to have my HTML formatted BIRT report converted to PDF then the PDF file will be downloaded or opened using a PDF viewer. <br />
<br />
Is this possible?
mwilliams
You could deploy the standard BIRT web viewer and call the viewer to run your HTML reports. From there, the viewer has a standard option of exporting to PDF so that the user can save a PDF copy. You could also embed this already created viewer within a JSP page as a part of your application using the tag library.
Hope this helps.
sjpondiong
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="68416" data-time="1284495015" data-date="14 September 2010 - 01:10 PM"><p>
You could deploy the standard BIRT web viewer and call the viewer to run your HTML reports. From there, the viewer has a standard option of exporting to PDF so that the user can save a PDF copy. You could also embed this already created viewer within a JSP page as a part of your application using the tag library.<br />
<br />
Hope this helps.<br /></p></blockquote>
<br />
Okay, thanks for the suggestion but I don't think my clients will agree to it.<br />
<br />
They want it similar to Jasper reports, where you can convert the report directly to PDF.
_Petr
<blockquote class='ipsBlockquote' data-author="'sjpondiong'" data-cid="68544" data-time="1284843286" data-date="18 September 2010 - 01:54 PM"><p>
Okay, thanks for the suggestion but I don't think my clients will agree to it.<br />
<br />
They want it similar to Jasper reports, where you can convert the report directly to PDF.<br /></p></blockquote>
Hi, sjpondiong<br />
You will look this topic <a class='bbc_url' href='
http://wiki.eclipse.org/Servlet_Example_(BIRT'>http://wiki.eclipse.org/Servlet_Example_(BIRT</a>)_2.1<br
/>
You need create Birt Servlet. In this servlet set content type <br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
resp.setContentType("application/pdf");
resp.setCharacterEncoding(encoding);
resp.setHeader("Content-Disposition", "inline; filename=utf-8''" + URLEncoder.encode(srb.getName().replace(' ', '_') + ".pdf", encoding));
</pre>
ant set type report <br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
options.setOutputFormat(HTMLRenderOption.OUTPUT_FORMAT_PDF);
</pre>
this all. )
sjpondiong
<blockquote class='ipsBlockquote' data-author="'_Petr'" data-cid="68546" data-time="1284887536" data-date="19 September 2010 - 02:12 AM"><p>
Hi, sjpondiong<br />
You will look this topic <a class='bbc_url' href='
http://wiki.eclipse.org/Servlet_Example_(BIRT'>http://wiki.eclipse.org/Servlet_Example_(BIRT</a>)_2.1<br
/>
You need create Birt Servlet. In this servlet set content type <br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
resp.setContentType("application/pdf");
resp.setCharacterEncoding(encoding);
resp.setHeader("Content-Disposition", "inline; filename=utf-8''" + URLEncoder.encode(srb.getName().replace(' ', '_') + ".pdf", encoding));
</pre>
ant set type report <br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
options.setOutputFormat(HTMLRenderOption.OUTPUT_FORMAT_PDF);
</pre>
this all. )<br /></p></blockquote>
<br />
<br />
thanks.. i will try this one
sjpondiong
@_Petr
: Thanks for the suggestion, I tried it though, all I got was a bunch of garbage characters printed on the screen.<br />
Please refer to the image.<br />
<br />
<img src='
http://img833.imageshack.us/img833/7968/screenshot3t.png'
alt='Posted Image' class='bbc_img' />
mwilliams
sjpondiong,
When using the web viewer, you call your reports by a URL. One of the URL parameters is __format. You can include this parameter in your url with it equal to "pdf" and your report will automatically be taken to PDF format. Maybe this will help.
sjpondiong
@mwilliams
: Thank you very much for the help and insights you have given me. I was able to solve the problem with your help. Sorry it took me a while to reply, I was busy with finishing the project.
mwilliams
Not a problem. Let us know whenever you have questions!
ocremedios
<p>Is it possible for you'll to explain to me where and what i need to change in the BIRT application which enables me to export report from the BIRT viewer to PDF. </p><p> </p><p>I need to know where i got to create the BIRT servlet and [color=rgb(40,40,40);font-family:helvetica, arial, sans-serif;font-size:14px;]URL parameters is __format so that i can get the viewer to export reports into PDF.[/color]</p><p> </p><p>[color=rgb(40,40,40);font-family:helvetica, arial, sans-serif;font-size:14px;]Thanks,[/color]</p><p>[color=rgb(40,40,40);font-family:helvetica, arial, sans-serif;font-size:14px;]Oscar[/color]</p>