RE: blank screen in browser
As far as I can tell all users are on IE 5.x to 6.x MZ -Original Message- From: Thorsten Scherler [mailto:[EMAIL PROTECTED] Sent: Thursday, November 21, 2002 11:36 AM To: [EMAIL PROTECTED] Subject: Re: blank screen in browser What browser use this 1%? Not all browser support adope reader as a plugin! Zahigian, Mike wrote: > I am using FOP embedded in a Servlet. Users trigger the servlet by clicking > a button on a web page. The servlet then takes the response and performs a > transformation and renders to pdf. The browser pops up a new window and > displays the pdf output. 1% or so of my user population cannot get the pdf > to display in the browser window that pops up (or any other browser window). > These users can open pdf files that exist on their local machine. When > these users click the print button on my web page, the new browser window > pops up, but the contents are blank. Any idea what is going on? > > Mike Z. > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
blank screen in browser
I am using FOP embedded in a Servlet. Users trigger the servlet by clicking a button on a web page. The servlet then takes the response and performs a transformation and renders to pdf. The browser pops up a new window and displays the pdf output. 1% or so of my user population cannot get the pdf to display in the browser window that pops up (or any other browser window). These users can open pdf files that exist on their local machine. When these users click the print button on my web page, the new browser window pops up, but the contents are blank. Any idea what is going on? Mike Z. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Performance Guidance
I get it. Do you know if I can similarly limit the number of instances of a servlet to one? Mike Z. -Original Message- From: Savino, Matt C [mailto:[EMAIL PROTECTED] Sent: Thursday, June 06, 2002 2:17 PM To: '[EMAIL PROTECTED]' Subject: RE: Performance Guidance I mean every other thread has to wait. I have the FOP processor wrapped in a stateless session bean and I limit the number of instances of that bean to one. This is because of the serious performance drop-off we see when FOP is run more than once concurrently. I'm still working out some of the details. Matt Savino > -Original Message- > From: Zahigian, Mike [mailto:[EMAIL PROTECTED] > Sent: Thursday, June 06, 2002 2:13 PM > To: '[EMAIL PROTECTED]' > Subject: RE: Performance Guidance > > > Matt, I'm not sure what you mean by a "one FOP processing thread per > appserver instance"? > > J., I am getting data out of some javabeans in the form of > xml, then this > xml is transformed using a stylesheet, then another > transformation takes > place to create the xsl:fo and then FOP takes over. I'll go > ahead and try > and profile--you think the bottleneck might be in the > transformations and > not in the final rendering? Do you have a profiler you can recommend? > > Thanks very much for the feedback. > > Mike Z. > > -Original Message- > From: Savino, Matt C [mailto:[EMAIL PROTECTED] > Sent: Thursday, June 06, 2002 1:51 PM > To: '[EMAIL PROTECTED]' > Subject: RE: Performance Guidance > > > I am curently working on a system to only allow one FOP > processing thread > per appserver instance. You can search my earlier posts for some > benchmarking results. > > > Matt Savino > > Senior Systems Analyst > Quest Diagnostics Inc. > 33608 Ortega Hwy > Building C > San Juan Capistrano, CA 92690 > 949.728.4832 > cel - 310-344-0889 > pg - 949-452-4566 > > > > > -Original Message- > > From: J.Pietschmann [mailto:[EMAIL PROTECTED] > > Sent: Thursday, June 06, 2002 1:47 PM > > To: [EMAIL PROTECTED] > > Subject: Re: Performance Guidance > > > > > > Zahigian, Mike wrote: > > > I am using FOP to take a single page of XSL:FO content and > > convert to PDF. > > > I have embedded FOP in a servlet. When I have one user > > requesting a page it > > > takes about 6 or 7 seconds to get the page formatted as > > PDF. It seems like > > > each additional simultaneous request pushes the response > > time by 6 or 7 > > > seconds. So, if 10 users request pages at about the same > > time, the 10th > > > user gets his page back in about a minute--and this is only > > one page. > > > > > > Is this the performance I should expect? What the ideal > > way to handle the > > > rendering process? Should I create a Rendering object that > > had a rendering > > > method or should I simply have a class with one static > > method that renders? > > > Any guidance on how to embed FOP and get better response time is > > > appreciated. > > > > The design of the embedding hardly matters for performance. > > The complexity of the layout usually matters. > > > > How much time does FOP need to render your FO from the command > > line? Does the time include the XSL transformation or is it FO > > rendering only? Use the -d switch to get timings. > > > > Do you use JDK1.3? Is HotSpot enabled? FOP is much slower on > > JDK 1.2 and earlier. > > > > Try to isolate the steps. Apply a profiler. You might find > > bottlenecks where you'd expect them last. > > In your case, I strongly suspect the bottleneck is data retrieval, > > not FO rendering, 7 seconds for a page sounds too much. You ought > > to get 1-2 pages per second on moderatly dated machines. > > > > J.Pietschmann > > > > >
RE: Performance Guidance
Matt, I'm not sure what you mean by a "one FOP processing thread per appserver instance"? J., I am getting data out of some javabeans in the form of xml, then this xml is transformed using a stylesheet, then another transformation takes place to create the xsl:fo and then FOP takes over. I'll go ahead and try and profile--you think the bottleneck might be in the transformations and not in the final rendering? Do you have a profiler you can recommend? Thanks very much for the feedback. Mike Z. -Original Message- From: Savino, Matt C [mailto:[EMAIL PROTECTED] Sent: Thursday, June 06, 2002 1:51 PM To: '[EMAIL PROTECTED]' Subject: RE: Performance Guidance I am curently working on a system to only allow one FOP processing thread per appserver instance. You can search my earlier posts for some benchmarking results. Matt Savino Senior Systems Analyst Quest Diagnostics Inc. 33608 Ortega Hwy Building C San Juan Capistrano, CA 92690 949.728.4832 cel - 310-344-0889 pg - 949-452-4566 > -Original Message- > From: J.Pietschmann [mailto:[EMAIL PROTECTED] > Sent: Thursday, June 06, 2002 1:47 PM > To: [EMAIL PROTECTED] > Subject: Re: Performance Guidance > > > Zahigian, Mike wrote: > > I am using FOP to take a single page of XSL:FO content and > convert to PDF. > > I have embedded FOP in a servlet. When I have one user > requesting a page it > > takes about 6 or 7 seconds to get the page formatted as > PDF. It seems like > > each additional simultaneous request pushes the response > time by 6 or 7 > > seconds. So, if 10 users request pages at about the same > time, the 10th > > user gets his page back in about a minute--and this is only > one page. > > > > Is this the performance I should expect? What the ideal > way to handle the > > rendering process? Should I create a Rendering object that > had a rendering > > method or should I simply have a class with one static > method that renders? > > Any guidance on how to embed FOP and get better response time is > > appreciated. > > The design of the embedding hardly matters for performance. > The complexity of the layout usually matters. > > How much time does FOP need to render your FO from the command > line? Does the time include the XSL transformation or is it FO > rendering only? Use the -d switch to get timings. > > Do you use JDK1.3? Is HotSpot enabled? FOP is much slower on > JDK 1.2 and earlier. > > Try to isolate the steps. Apply a profiler. You might find > bottlenecks where you'd expect them last. > In your case, I strongly suspect the bottleneck is data retrieval, > not FO rendering, 7 seconds for a page sounds too much. You ought > to get 1-2 pages per second on moderatly dated machines. > > J.Pietschmann > >
Performance Guidance
I am using FOP to take a single page of XSL:FO content and convert to PDF. I have embedded FOP in a servlet. When I have one user requesting a page it takes about 6 or 7 seconds to get the page formatted as PDF. It seems like each additional simultaneous request pushes the response time by 6 or 7 seconds. So, if 10 users request pages at about the same time, the 10th user gets his page back in about a minute--and this is only one page. Is this the performance I should expect? What the ideal way to handle the rendering process? Should I create a Rendering object that had a rendering method or should I simply have a class with one static method that renders? Any guidance on how to embed FOP and get better response time is appreciated. Mike Zahigian, Sr. Programmer/Systems Analyst Amgen Business Information Systems (805) 447-2819 mailto:[EMAIL PROTECTED]
FOP scalability
Does anyone know how efficient FOP might be when running on Sun Solaris box? If I am using XSL template objects to optimize performance, how might response times vary with increased number of users? Assume the Solaris box is a single 420R with 4 cpus and 4GB of RAM. Any help is this regard and ideas about making my FOP-based rendering solution more scalable is greatly appreciated. Mike Zahigian, Sr. Programmer/Systems Analyst Amgen Business Information Systems (805) 447-2819 mailto:[EMAIL PROTECTED]
RE: FOP in server
Here's a simple servlet that will work. Like the FOP servlet, you give it a fo file or an xml/xsl combination in a get parameter. You have to have the latest xalan and xerces in addition to fop, because I handle the xml transformation within the servlet as opposed to using the fop methods for transformation. If you're using tomcat, your url to hit the servlet will be something like, http://localhost:8080/app/simple?fo=../webapps/app/xslfo/test.fo Make sure you're element has a master-reference attribute and not a master-name attribute. This was a recent change, I guess. Here's the code for the simple servlet as well as a test fo document. Mike Z SERVLET import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import org.xml.sax.InputSource; import org.apache.fop.apps.Driver; import javax.xml.transform.stream.*; import javax.xml.transform.*; public class SimpleServlet extends HttpServlet { private static final String FO_REQUEST_PARAM = "fo"; private static final String XML_REQUEST_PARAM = "xml"; private static final String XSL_REQUEST_PARAM = "xsl"; // you might want to override init() and set up a log4j category for the servlet so you can easily add debugging // code public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { // you might want to set up a constant to represent the directory path or pull the directory path // from a configuration file, otherwise you have to supply the path in the get parameter String foParam = request.getParameter(FO_REQUEST_PARAM); String xmlParam = request.getParameter(XML_REQUEST_PARAM); String xslParam = request.getParameter(XSL_REQUEST_PARAM); ByteArrayOutputStream out = new ByteArrayOutputStream(); InputSource input = null; // set content type as pdf so browser will know it's getting pdf content and display it properly response.setContentType("application/pdf"); if ((request.getParameter(FO_REQUEST_PARAM)) != null) { FileInputStream fo = new FileInputStream(foParam); input = new InputSource(fo); } else if(((request.getParameter(XML_REQUEST_PARAM)) != null) && ((request.getParameter(XSL_REQUEST_PARAM)) != null)) { File xml = new File(xmlParam); File xsl = new File(xslParam); Source xmlSource = new StreamSource(xml); Source xslSource = new StreamSource(xsl); StringWriter sw = new StringWriter(); TransformerFactory tFactory = TransformerFactory.newInstance(); //create Templates so the xsl document will function as a template and will be cached in //order to optimize performance Templates cachedXSLT = tFactory.newTemplates(xslSource); Transformer transformer = cachedXSLT.newTransformer(); //transform the xml we've been given using the cached xsl transformer.transform(xmlSource, new StreamResult(sw)); Reader r = new StringReader(sw.toString()); input = new InputSource(r); } else { // handle situation: get parameters are not correct } if (input != null) { Driver driver = new Driver(input, out); driver.setRenderer(Driver.RENDER_PDF); driver.run(); } //send content to the browser now byte[] content = out.toByteArray(); response.setContentLength(content.length); response.getOutputStream().write(content); response.getOutputStream().flush(); } catch (Exception e) { // handle exceptions. } } // pass post data received to get for processing public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { doGet(request, response); } } FO __ http://www.w3.org/1999/XSL/Format";> John Doe 5130 B27 2819 XPT -Original Message- From: Pedro Barco Bernal [mailto:[EMAIL PROTECTED] Sent: Monday, February 04, 2002 11:20 PM To: [EMAIL PROTECTED] Subject: FOP in server ¿Someone have used FOP in server? We are calling FOP from Java Server Pages and the server send a ERROR mess
RE: Help to get started in a servlet
Here's a simple servlet that will work. Like the FOP servlet, you give it a fo file or an xml/xsl combination in a get parameter. You have to have the latest xalan and xerces in addition to fop, because I handle the xml transformation within the servlet as opposed to using the fop methods for transformation. Let me know if you have any trouble. Mike Z import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import org.xml.sax.InputSource; import org.apache.fop.apps.Driver; import javax.xml.transform.stream.*; import javax.xml.transform.*; public class SimpleServlet extends HttpServlet { private static final String FO_REQUEST_PARAM = "fo"; private static final String XML_REQUEST_PARAM = "xml"; private static final String XSL_REQUEST_PARAM = "xsl"; // you might want to override init() and set up a log4j category for the servlet so you can easily add debugging // code public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { // you might want to set up a constant to represent the directory path or pull the directory path // from a configuration file, otherwise you have to supply the path in the get parameter String foParam = request.getParameter(FO_REQUEST_PARAM); String xmlParam = request.getParameter(XML_REQUEST_PARAM); String xslParam = request.getParameter(XSL_REQUEST_PARAM); ByteArrayOutputStream out = new ByteArrayOutputStream(); InputSource input = null; // set content type as pdf so browser will know it's getting pdf content and display it properly response.setContentType("application/pdf"); if ((request.getParameter(FO_REQUEST_PARAM)) != null) { FileInputStream fo = new FileInputStream(foParam); input = new InputSource(fo); } else if(((request.getParameter(XML_REQUEST_PARAM)) != null) && ((request.getParameter(XSL_REQUEST_PARAM)) != null)) { File xml = new File(xmlParam); File xsl = new File(xslParam); Source xmlSource = new StreamSource(xml); Source xslSource = new StreamSource(xsl); StringWriter sw = new StringWriter(); TransformerFactory tFactory = TransformerFactory.newInstance(); //create Templates so the xsl document will function as a template and will be cached in //order to optimize performance Templates cachedXSLT = tFactory.newTemplates(xslSource); Transformer transformer = cachedXSLT.newTransformer(); //transform the xml we've been given using the cached xsl transformer.transform(xmlSource, new StreamResult(sw)); Reader r = new StringReader(sw.toString()); input = new InputSource(r); } else { // handle situation: get parameters are not correct } if (input != null) { Driver driver = new Driver(input, out); driver.setRenderer(Driver.RENDER_PDF); driver.run(); } //send content to the browser now byte[] content = out.toByteArray(); response.setContentLength(content.length); response.getOutputStream().write(content); response.getOutputStream().flush(); } catch (Exception e) { // handle exceptions. } } // pass post data received to get for processing public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { doGet(request, response); } } -Original Message- From: Chinn, Gale [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 05, 2002 7:58 AM To: '[EMAIL PROTECTED]' Subject: Help to get started in a servlet I am new to fop and can get it to run command line, but would like to get it to run in a servlet. I have followed the info on fop's embedding page using fop.war file in the webapps directory of Tomcat on ver 3.2 and 4, but cannot get it to work using: http://localhost:8080/fop/fop?fo=... or http://localhost:8080/fop/servlet/fop?fo=... I would just like to get a simple pdf to come back to my browser to prove a point to my group leader. Any help would be appreciated TIA, Gale Chinn Programmer/Analyst Cessna Aircraft Company Wichita, KS
RE: XML, XSL a real problem
renderXML(input, request, response); } else { logs.error("Problem rendering document to Pdf: parameters supplied were incorrect. "); String message = "There has been an error rendering your timesheet to Pdf."; RequestDispatcher rd = request.getRequestDispatcher( "Error.jsp?message=" + message); rd.forward(request, response); } } catch (Exception e) { logs.error("Problem rendering document to Pdf: " + e); String message = "There has been an error rendering your timesheet to Pdf."; RequestDispatcher rd = request.getRequestDispatcher( "Error.jsp?message=" + message); rd.forward(request, response); } } /** * renders an FO inputsource into a PDF file which is rendered * directly to the response object's OutputStream */ public void renderFO(InputSource foFile, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { ByteArrayOutputStream out = new ByteArrayOutputStream(); response.setContentType("application/pdf"); Driver driver = new Driver(foFile, out); logs.debug("Just created driver"); //driver.setLogger(logs); driver.setRenderer(Driver.RENDER_PDF); logs.debug("Just set renderer for driver"); driver.run(); logs.debug("Just called run on driver"); byte[] content = out.toByteArray(); response.setContentLength(content.length); response.getOutputStream().write(content); response.getOutputStream().flush(); } catch (Exception e) { logs.error("Problem rendering document to Pdf: error in renderFO " + e); String message = "There has been an error rendering your timesheet to Pdf."; RequestDispatcher rd = request.getRequestDispatcher( "Error.jsp?message=" + message); rd.forward(request, response); } } public void renderXML(XSLTInputHandler input, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { logs.debug("In renderXML"); InputSource foFile = input.getInputSource(); renderFO(foFile, request, response); } catch (Exception e) { logs.error("Problem rendering document to Pdf: error in renderXML " + e); String message = "There has been an error rendering your timesheet to Pdf."; RequestDispatcher rd = request.getRequestDispatcher( "Error.jsp?message=" + message); rd.forward(request, response); } } /** * creates a SAX parser, using the value of org.xml.sax.parser * defaulting to org.apache.xerces.parsers.SAXParser * * @return the created SAX parser */ static XMLReader createParser() throws ServletException { String parserClassName = System.getProperty("org.xml.sax.parser"); if (parserClassName == null) { parserClassName = "org.apache.xerces.parsers.SAXParser"; } try { return (XMLReader) Class.forName( parserClassName).newInstance(); } catch (Exception e) { throw new ServletException(e); } } } -Original Message- From: Scott Moore [mailto:[EMAIL PROTECTED] Sent: Friday, February 01, 2002 9:10 AM To: [EMAIL PROTECTED] Subject: Re: XML, XSL a real problem Yes, at least the XML part. The XSLT is on the server so the client doesn't send it, but I could get it exactly the same way I get the XML. What exactly are you having problems with? Writing the servlet code to retrieve an XML document from a POST? Scott - Original Message - From: "Zahigian, Mike" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, February 01, 2002 12:03 PM Subject: XML, XSL a real problem > Has anybody managed to get a Java Servlet to accept xml, xsl stylesheet > including fo and render to pdf? I've been struggling for days and am > running out of time before I have to abandon FOP for this project. If > possible, include your xml, xsl, and servlet code so I can work from there. > Thanks in advance for any help. > > Mike Zahigian > Business Information Systems > x72819 >
XML, XSL a real problem
Has anybody managed to get a Java Servlet to accept xml, xsl stylesheet including fo and render to pdf? I've been struggling for days and am running out of time before I have to abandon FOP for this project. If possible, include your xml, xsl, and servlet code so I can work from there. Thanks in advance for any help. Mike Zahigian Business Information Systems x72819
Namespace not supported
When I try and perform an xml/xsl transformation with the FopServlet I get a FOPException: Namespace not supported. Rendering an "fo" file with the servlet works. Anyone know how to fix this issue? If we can solve this issue maybe we should include the improved example code in the distribution examples. Mike Zahigian Business Information Systems x72819
FW: FOPException --- Root element must be root, not (none):gloss ary
I'm running FOP embedded in a servlet. When I call FOP specifying an xml file and an xsl file as parameters, I get this error. When I call the servlet with an fo file everything works fine. The xml file I'm using is glossary.xml and the xsl file is glossary.xsl from the examples/markers directory of the distribution. Anybody have a clue as to what's wrong? Mike Zahigian Business Information Systems x72819