You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by mvadlamudi <mv...@osi-tech.com> on 2009/01/25 09:28:01 UTC
Re: Converting HTML content to PDF
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
--
View this message in context: http://www.nabble.com/Converting-HTML-content-to-PDF-tp6203248p21649427.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Converting HTML content to PDF
Posted by mvadlamudi <mv...@osi-tech.com>.
Hi
how to use Fop in spring framework for html to pdf convertion.
is there any jar file available for this?
--
View this message in context: http://www.nabble.com/Converting-HTML-content-to-PDF-tp6203248p21679566.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Converting HTML content to PDF
Posted by Dave Newton <ne...@yahoo.com>.
Martin Gainty wrote:
> FOP (Formatting Object Processor) is what you're looking for..
> http://xmlgraphics.apache.org/fop/
It kinda looks like the OP is using iText:
>>> SAXiTextHandler saxHandler = new SAXiTextHandler(doc);
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Converting HTML content to PDF
Posted by Wes Wannemacher <we...@wantii.com>.
On Wednesday 28 January 2009 10:20:54 Dave Newton wrote:
> Dhiraj Thakur wrote:
> > u can do that on seam framework.
> >
> > http://docs.jboss.org/seam/1.1.5.GA/reference/en/html/mail.html
>
> The only reference I see to PDF on that page is the link to the previous
> chapter; can you be more specific? (I mean, we're not talking about
> using Seam or email, but at least we can get the right link. Did you
> mean http://docs.jboss.org/seam/1.1.5.GA/reference/en/html/itext.html?)
>
> Dave
>
>
The OP wants to grab a remote resource via URL, then convert it to PDF.
--
Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Converting HTML content to PDF
Posted by Dave Newton <ne...@yahoo.com>.
Dhiraj Thakur wrote:
> u can do that on seam framework.
>
> http://docs.jboss.org/seam/1.1.5.GA/reference/en/html/mail.html
The only reference I see to PDF on that page is the link to the previous
chapter; can you be more specific? (I mean, we're not talking about
using Seam or email, but at least we can get the right link. Did you
mean http://docs.jboss.org/seam/1.1.5.GA/reference/en/html/itext.html?)
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Converting HTML content to PDF
Posted by Dhiraj Thakur <de...@gmail.com>.
u can do that on seam framework.
http://docs.jboss.org/seam/1.1.5.GA/reference/en/html/mail.html
Regards,
Dhiraj
Re: Converting HTML content to PDF
Posted by Manos Batsis <ma...@geekologue.com>.
To the OP: Just try xhtmlrenderer (i.e. The Flying Saucer Project). I
once did a servlet filter that intercepted text/html responses (usually
from JSPs) and transformed them to PDF on the fly. Don't seem able to
figure out where that code is nowadays though.
[1] https://xhtmlrenderer.dev.java.net/
hth,
Manos
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Converting HTML content to PDF
Posted by Wes Wannemacher <we...@wantii.com>.
On Tuesday 27 January 2009 23:21:32 ManiKanta G wrote:
> > i am trying to load page from url and write in to the pdf.
> > can please reviw my code and send the solution.
> > if u want any more information send me mail.
>
> This is a bit interesting situation... I m eager to listen... feel free to
> share that will us too... though it is off topic I dont mind... after all
> we are here to learn some thing...
>
I'm thinking there aren't a lot of responses because this is not as trivial a
problem as the OP appears to think. I've seen mention of both iText and FOP,
but in my experience, neither can easily go from HTML to PDF. I know,
personally, I have trouble creating HTML that will render consistently across
browsers, to try to create a tool to render HTML and output a PDF is a tall
task. Maybe rather than trying to find a Java library to do it, you could look
into hooking into a rendering engine (Gecko? WebKit?) and then linking to a
Ghostscript libraries. If you're a talented C Programmer, you might be better
off in this situation.
Of course, if you are not required to generate a PDF that resembles a view
that a browser would render, then you might be able to find an XSLT that
transforms XHTML into XSLFO which FOP could then convert to PDF. However,
since you mention that you want to load a page from a URL, I'm guessing that
you can't trust the source doc to be valid XML.
Just my $.02
-Wes
--
Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Converting HTML content to PDF
Posted by ManiKanta G <go...@gmail.com>.
>
> i am trying to load page from url and write in to the pdf.
> can please reviw my code and send the solution.
> if u want any more information send me mail.
>
This is a bit interesting situation... I m eager to listen... feel free to
share that will us too... though it is off topic I dont mind... after all we
are here to learn some thing...
ManiKanta
RE: Converting HTML content to PDF
Posted by mvadlamudi <mv...@osi-tech.com>.
Hi,
Thanks for reply.
i am trying to load page from url and write in to the pdf.
can please reviw my code and send the solution.
if u want any more information send me mail.
--
View this message in context: http://www.nabble.com/Converting-HTML-content-to-PDF-tp6203248p21679603.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: Converting HTML content to PDF
Posted by Martin Gainty <mg...@hotmail.com>.
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.dave@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-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
_________________________________________________________________
Windows Live™ Hotmail®:…more than just e-mail.
http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t2_hm_justgotbetter_explore_012009
Re: Converting HTML content to PDF
Posted by Dave Newton <ne...@yahoo.com>.
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-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org