FOP (Formatting Object Processor) is what you're looking for..
http://xmlgraphics.apache.org/fop/

feel free to email me offline as this is off-topic to Struts

HTH/
Martin
______________________________________________ 
Disclaimer and confidentiality note 
Everything in this e-mail and any attachments relates to the official business 
of Sender. This transmission is of a confidential nature and Sender does not 
endorse distribution to any party other than intended recipient. Sender does 
not necessarily endorse content contained within this transmission. 




> Date: Sun, 25 Jan 2009 13:34:03 -0500
> From: newton.d...@yahoo.com
> To: user@struts.apache.org
> Subject: Re: Converting HTML content to PDF
> 
> I'm not sure this is related to Struts.
> 
> Dave
> 
> mvadlamudi wrote:
> > i tryed the same in spring framework.
> > see the below code ,but i got the following error.
> > 
> > code:
> > 
> > 
> > HttpSession session = request.getSession();
> >                      URL reconstructedURL = new URL(request.getScheme(),
> >                                      request.getServerName(),
> >                                      request.getServerPort(),
> >                                      
> > "/ci/agent/viewagent;jsessionid="+request.getSession().getId());            
> >             
> >                      URLConnection con=reconstructedURL.openConnection();   
> >                  
> >                       con.setDoOutput(true);
> >                       con.setDoInput(true);
> >                       con.setUseCaches(false);
> >                       con.setAllowUserInteraction(true);
> >                       con.setRequestProperty("Connection","keep-alive");
> >                       con.setRequestProperty("cookie", session.toString()); 
> >                   
> >                       con.connect();
> >                       InputStream stream = con.getInputStream();            
> >           
> >                       //System.out.println(con.getOutputStream());
> >                       System.out.println(con.getConnectTimeout());
> >                       System.out.println(con.getContentType());
> >                       System.out.println(con.getURL());
> >                       response.setContentType("application/pdf");
> >                       response.setHeader("Expires", "0");
> >                       response.setHeader("Cache-Control",
> >                             "must-revalidate, post-check=0, pre-check=0");
> >                       response.setHeader("Pragma", "public");
> >                             // Read all the text returned by the server
> >                             /*in = new BufferedReader(new
> > InputStreamReader(con.getURL().openStream()));
> >                             String str=null;
> >                             String str1="";
> >                             while ((str = in.readLine()) != null) {
> >                                 // str is one line of text; readLine() 
> > strips the newline
> > character(s)
> >                                     System.out.println(""+str);
> >                                     str1=str1+str;
> >                             }*/
> >                     
> >                      BaseFont bf = BaseFont.createFont();
> >                      SAXParserFactory parserFactory = 
> > SAXParserFactory.newInstance();
> >                 
> >                      doc.open();
> >                      doc.newPage();                  
> >                      parserFactory.setValidating(false);
> >                     parserFactory.setNamespaceAware(false);                 
> >                                         
> >                      SAXParser parser = parserFactory.newSAXParser();
> >                     
> > //parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage";,
> > "http://www.w3.org/2001/XMLSchema";);
> >                      writer.getInstance(doc, new 
> > FileOutputStream("C:\\Hello.pdf"));                         
> >                      SAXiTextHandler saxHandler = new SAXiTextHandler(doc); 
> >                                         
> >                     //HtmlParser.parse(doc,stream);
> >                      parser.parse(stream, saxHandler);
> > 
> > error:
> > 
> > java.lang.ClassCastException: com.lowagie.text.Table
> >     at com.lowagie.text.xml.SAXiTextHandler.handleStartingTags(Unknown 
> > Source)
> >     at com.lowagie.text.xml.SAXiTextHandler.startElement(Unknown Source)
> >     at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown
> > Source)
> >     at
> > org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown
> > Source)
> >     at
> > org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
> > Source)
> >     at
> > org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
> > Source)
> >     at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> >     at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> >     at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
> >     at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
> >     at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown
> > Source)
> >     at javax.xml.parsers.SAXParser.parse(Unknown Source)
> >     at javax.xml.parsers.SAXParser.parse(Unknown Source)
> >     at
> > com.kerio.ci.web.graphs.availability.controller.ViewShowPdf.buildPdfDocument(ViewShowPdf.java:116)
> >     at
> > org.springframework.web.servlet.view.document.AbstractPdfView.renderMergedOutputModel(AbstractPdfView.java:87)
> >     at
> > org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:243)
> >     at
> > org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1141)
> >     at
> > org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:878)
> >     at
> > org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:792)
> >     at
> > org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:475)
> >     at
> > org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:430)
> >     at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
> >     at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
> >     at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> >     at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> >     at
> > com.kerio.ci.web.common.filter.CIUserSecretQuestionFilter.doFilter(CIUserSecretQuestionFilter.java:68)
> >     at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
> >     at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> >     at
> > com.kerio.ci.web.common.filter.CIUserSessionFilter.doFilter(CIUserSessionFilter.java:85)
> >     at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
> >     at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> >     at
> > com.kerio.ci.web.common.filter.CIUserPrivilegesFilter.doFilter(CIUserPrivilegesFilter.java:79)
> >     at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
> >     at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> >     at
> > org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
> >     at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
> >     at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> >     at
> > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
> >     at
> > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
> >     at
> > org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
> >     at
> > org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
> >     at
> > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
> >     at
> > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
> >     at
> > org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
> >     at
> > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
> >     at
> > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
> >     at
> > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
> >     at
> > org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
> >     at
> > org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
> >     at
> > org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
> >     at java.lang.Thread.run(Thread.java:595)
> > 
> > if u have the solution send me back
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 

_________________________________________________________________
Windows Live™ Hotmail®:…more than just e-mail. 
http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t2_hm_justgotbetter_explore_012009

Reply via email to