Hello,
I´m using Seam 1.1.0 and it´s great.
There´s a Seam-Component for Japser Reports that´s working fine.
However opening PDF (inline) in InternetExplorer requiers a hack.
See
http://xmlgraphics.apache.org/fop/0.93/servlets.html
Notes on Microsoft Internet Explorer
Some versions of Internet Explorer will not automatically show the PDF...However, Internet
Explorer can still be used to download the PDF so that it can be viewed later....
..Use an URL ending in .pdf, like
http://myserver/servlet/stuff.pdf. Yes, the servlet can
be configured to handle this. If the URL has to contain parameters, try to have both the
base URL as well as the last parameter end in .pdf, if necessary append a dummy parameter,
like
http://myserver/servlet/stuff.pdf?par1=a&par2=b&d=.pdf. The effect may depend
on IEx version.
I was trying to append a dummy=.pdf parameter to the url using pages.xml, but the
dummy-parameter is not appended at the very end, because Seam´s Redirect Filter appends
the ConversationId to the url.
I know, that ist not the job of Seam to support an ugly workaround for IE to open PDF
inline. But I hope, that someone can help me to solve this problem.
Thanks
jpb
Here´s the code to produce the PDF on the fly:
public String makePdf() {
| ...
| JRBeanCollectionDataSource jrDataSource = new JRBeanCollectionDataSource(items);
| Map paramMap = new HashMap();
|
| try {
| JasperPrint jasperPrint = JasperFillManager.fillReport(productReport, paramMap,
jrDataSource);
| HttpServletResponse response = (HttpServletResponse)
facesContext.getExternalContext().getResponse();
| ServletOutputStream out = response.getOutputStream();
|
| ByteArrayOutputStream baos = new ByteArrayOutputStream();
| JasperExportManager.exportReportToPdfStream(jasperPrint, baos);
|
| response.setContentType("application/pdf");
| response.setHeader("Expires", "0");
| response.setHeader("Cache-Control",
| "must-revalidate, post-check=0, pre-check=0");
| response.setHeader("Pragma", "public");
| String filename = "Produktliste.pdf";
| response.setHeader("Content-Disposition", "inline;
filename=\"" + filename + "\"");
|
| // contentlength required for MSIE
| response.setContentLength(baos.size());
|
| baos.writeTo(out);
| out.flush();
| out.close();
|
| FacesContext.getCurrentInstance().responseComplete();
| ...
|
| return Constants.View.REDIRECT.getNav();
| }
|
|
|
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4007894#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...