Loading ...
Sorry, an error occurred while loading the content.

PDFs direct to browser?

Expand Messages
  • Steve Murphy
    Hi, We are trying to modify the FopServlet example to run from a JSP. We are not getting the PDF to display correctly in browser. We are getting Error 500: no
    Message 1 of 2 , Sep 1 6:48 AM
    • 0 Attachment
      Hi,

      We are trying to modify the FopServlet example to run
      from a JSP. We are not getting the PDF to display
      correctly in browser. We are getting "Error 500:
      no protocol:" followed by the FO source. Also, we
      are calling the JSP directly 'print_response.jsp'.
      Does anyone have any ideas?

      Here's our source code:

      ByteArrayOutputStream outStuff = new
      ByteArrayOutputStream();
      response.setContentType("application/pdf");

      Driver driver = new Driver(is, outStuff);

      Logger logger = null;
      driver.setLogger(logger);

      driver.setRenderer(Driver.RENDER_PDF);
      driver.run();

      byte[] content = outStuff.toByteArray();
      response.setContentLength(content.length);
      response.getOutputStream().write(content);
      response.getOutputStream().flush();

      Thanks

      Steve



      __________________________________________________
      Do You Yahoo!?
      Yahoo! Finance - Get real-time stock quotes
      http://finance.yahoo.com
    • ed nixon
      Have you looked at the Cocoon processing framework from the Apache project? There are examples in the distribution of serving PDF in real-time via servelet.
      Message 2 of 2 , Sep 1 7:09 AM
      • 0 Attachment
        Have you looked at the Cocoon processing framework from the Apache
        project? There are examples in the distribution of serving PDF in
        real-time via servelet. You might get some insight from that code.

        ...edN

        Steve Murphy wrote:
        > Hi,
        >
        > We are trying to modify the FopServlet example to run
        > from a JSP. We are not getting the PDF to display
        > correctly in browser. We are getting "Error 500:
        > no protocol:" followed by the FO source. Also, we
        > are calling the JSP directly 'print_response.jsp'.
        > Does anyone have any ideas?
        >
        > Here's our source code:
        >
        > ByteArrayOutputStream outStuff = new
        > ByteArrayOutputStream();
        > response.setContentType("application/pdf");
        >
        > Driver driver = new Driver(is, outStuff);
        >
        > Logger logger = null;
        > driver.setLogger(logger);
        >
        > driver.setRenderer(Driver.RENDER_PDF);
        > driver.run();
        >
        > byte[] content = outStuff.toByteArray();
        > response.setContentLength(content.length);
        > response.getOutputStream().write(content);
        > response.getOutputStream().flush();
        >
        > Thanks
        >
        > Steve
        >
        >
        >
        > __________________________________________________
        > Do You Yahoo!?
        > Yahoo! Finance - Get real-time stock quotes
        > http://finance.yahoo.com
        >
        >
        > To unsubscribe from this group, send an email to:
        > XSL-FO-unsubscribe@egroups.com
        >
        >
        >
        > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
        >
        >
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.