You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by "Carter, Will" <WC...@envestnetpmc.com> on 2002/07/18 00:45:43 UTC

RE: embedded fop...show progress?

Carter, Will wrote:
> I am using fop in a servlet.  Has anyone ever come up with a way to report
> back to the browser where it's at in the converting process from an fo file
> to a to pdf?

okay I got the first part figured out.  I got the log events limited to display only when a page is created.  I went through through and commenting out each time a call to log happens, except for when it's reporting that a page created.

I changed this line in PageSequence.java:
log.info("[" + currentPageNumber + "]");
to
log.info("Page Produced: " + currentPageNumber );

so now my console spits out infos only when pages are created.
...but I want it to do something in the browser when this happens.

J.Pietschmann wrote:
> I haven't tried personally but you can try various
> approaches.
> One could be to send back a text/html and redirect the FOP
> log into the servlet's output stream (look into the source
> of Driver.java:getLogger(), create a target with the servlet
> output stream instead of System.out)

can you elaborate on this a little more?

in my servlet I convert an fo file to pdf, which is written to a file.  after it has done it's work, the servlet redirects the browser with the following code.  How can I get the servlet to do something in the browser (reload or something) every time a page creation log event happens.

   PrintWriter out = response.getWriter();
   response.setContentType("text/html");
   out.println("<!DOCTYPE");
   out.println("html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\"");
   out.println("\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">");
   out.println("<html>");
   out.println("<body>");
   out.println("<script language=javascript>self.location.href=http://www.somewhere.com
   </script>");
   out.println("</body></html>");

I am a java beginner, and any help would be very much appreciated.

will