try something like this; it will open the pdf viewer in your browser
public class ShowDocumentAction extends BasicAction { public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { HttpSession session = request.getSession(); try { Object object = session.getAttribute("BlobObject"); if (object != null) { DocumentDetailModel detailModel = (DocumentDetailModel)object; ByteArrayOutputStream baos = new ByteArrayOutputStream(); Document document = new Document(); PdfWriter.getInstance(document, baos); // Using the library of Bruno Lowagie to convert xml to PDF Parser parser = ParserFactory.makeParser("org.apache.xerces.parsers.SAXParser"); parser.setDocumentHandler(new SAXiTextHandler(document)); ByteArrayInputStream stream = new ByteArrayInputStream(detailModel.getDetail()); // this is an array of byte InputSource inputSource = new InputSource(stream); parser.parse(inputSource); response.setContentType("application/pdf"); response.setContentLength(baos.size()); ServletOutputStream out = response.getOutputStream(); baos.writeTo(out); out.flush(); } } catch (Exception ex) { } return ""; } } Best regards, Thierry ----- Original Message ----- From: "Duncan Harris" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, January 30, 2002 10:18 PM Subject: Re: Problem With Forwarding to a non-HTML file > [EMAIL PROTECTED] (Mark Woon) wrote: > > > Sorry, I guess I should also have added that PDF files are ocassionally > > generated on the fly., in which case there's really nothing to redirect or > > forward to. Is there anything I can do in these situations? > > The Inland Revenue site in the UK does this, if you fancy filling > in a dummy tax return to see how it works... :-) > http://www.inlandrevenue.gov.uk/ > If you are interested you must go to the Self assessment then after > creating a new forms log-in, select download and print locally. > > When I used to do CGI I used to do things with the extra path > to fool the browser: /cgi-bin/genpdf.exe/docname.pdf > I think maybe something similar is possible with servlets. > > Duncan Harris > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Hartford, Cheshire, U.K., Tel: 07968 060418 > Looking for STRUTS contract work in the U.K. > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>