FAQ
Hi all,



I am trying to programmatically convert an HTML file to pdf dynamically;
by setting the content type. But, I am not being able to succeed.

Any pointers regarding the same will be of much use.



Please note that, I am not using a JSP here. (So that, I could be able
to set the "content" of the "response").



With best regards,

Anjishnu.





**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Infosys has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. You should carry out your own virus checks before opening the e-mail or attachment. Infosys reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***

Search Discussions

  • Frank W. Zammetti at Sep 8, 2006 at 5:57 am
    Hi,

    Setting the content type is not sufficient to generate a PDF... are you
    trying to output a PDF from an existing HTML file, or are you
    dynamically generating the HTML? You say you aren't using JSP, so I'm
    thinking your either forwarding to an HTML page, or generating it in
    your Action. While there are HTML to PDF converters, I'm not sure which
    if any could be called from a webapp, and even so, typically dynamically
    generated PDF doesn't make a stop as HTML first, so it might help to
    understand a little better what your trying to do to offer some
    suggestions. But, it is definitely more than just the content type.

    Frank

    Anjishnu Bandyopadhyay wrote:
    Hi all,




    I am trying to programmatically convert an HTML file to pdf dynamically;
    by setting the content type. But, I am not being able to succeed.

    Any pointers regarding the same will be of much use.




    Please note that, I am not using a JSP here. (So that, I could be able
    to set the "content" of the "response").




    With best regards,

    Anjishnu.






    **************** CAUTION - Disclaimer *****************
    This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Infosys has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. You should carry out your own virus checks before opening the e-mail or attachment. Infosys reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the Infosys e-mail system.
    ***INFOSYS******** End of Disclaimer ********INFOSYS***
    --
    Frank W. Zammetti
    Founder and Chief Software Architect
    Omnytex Technologies
    http://www.omnytex.com
    AIM/Yahoo: fzammetti
    MSN: fzammetti@hotmail.com
    Author of "Practical Ajax Projects With Java Technology"
    (2006, Apress, ISBN 1-59059-695-1)
    Java Web Parts - http://javawebparts.sourceforge.net
    Supplying the wheel, so you don't have to reinvent it!

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
    For additional commands, e-mail: user-help@struts.apache.org
  • Mvadlamudi at Jan 25, 2009 at 8:28 am
    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
  • Dave Newton at Jan 25, 2009 at 6:34 pm
    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
  • Martin Gainty at Jan 26, 2009 at 1:54 am
    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
  • Dave Newton at Jan 26, 2009 at 2:53 am

    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
  • Mvadlamudi at Jan 27, 2009 at 9:49 pm
    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
  • Mvadlamudi at Jan 27, 2009 at 9:54 pm
    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
  • ManiKanta G at Jan 28, 2009 at 4:22 am

    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
  • Wes Wannemacher at Jan 28, 2009 at 4:33 am

    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
  • Manos Batsis at Jan 28, 2009 at 8:33 am
    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
  • Dhiraj Thakur at Jan 28, 2009 at 8:48 am
    u can do that on seam framework.

    http://docs.jboss.org/seam/1.1.5.GA/reference/en/html/mail.html

    Regards,
    Dhiraj
  • Dave Newton at Jan 28, 2009 at 3:21 pm

    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
  • Wes Wannemacher at Jan 28, 2009 at 3:27 pm

    On Wednesday 28 January 2009 10:20:54 Dave Newton wrote:
    Dhiraj Thakur wrote:
    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
  • Anjishnu Bandyopadhyay at Sep 8, 2006 at 6:01 am
    Hi Frank,



    I am generating the HTML page from my JavaScript file through
    "document.writeln()";

    I want to open this dynamically generated window in a PDF document.



    With best regards,

    Anjishnu.





    -----Original Message-----
    From: Frank W. Zammetti
    Sent: Thursday, September 07, 2006 11:22 AM
    To: Struts Users Mailing List
    Subject: Re: Converting HTML content to PDF



    Hi,



    Setting the content type is not sufficient to generate a PDF... are you

    trying to output a PDF from an existing HTML file, or are you

    dynamically generating the HTML? You say you aren't using JSP, so I'm

    thinking your either forwarding to an HTML page, or generating it in

    your Action. While there are HTML to PDF converters, I'm not sure which


    if any could be called from a webapp, and even so, typically dynamically


    generated PDF doesn't make a stop as HTML first, so it might help to

    understand a little better what your trying to do to offer some

    suggestions. But, it is definitely more than just the content type.



    Frank



    Anjishnu Bandyopadhyay wrote:
    Hi all,
    >

    >

    >

    >
    I am trying to programmatically convert an HTML file to pdf
    dynamically;
    by setting the content type. But, I am not being able to succeed. >
    Any pointers regarding the same will be of much use.
    >

    >

    >

    >
    Please note that, I am not using a JSP here. (So that, I could be able
    to set the "content" of the "response").
    >

    >

    >

    >
    With best regards, >
    Anjishnu.
    >

    >

    >

    >

    >

    >
    **************** CAUTION - Disclaimer *****************
    This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended
    solely for the use of the addressee(s). If you are not the intended
    recipient, please notify the sender by e-mail and delete the original
    message. Further, you are not to copy, disclose, or distribute this
    e-mail or its contents to any other person and any such actions are
    unlawful. This e-mail may contain viruses. Infosys has taken every
    reasonable precaution to minimize this risk, but is not liable for any
    damage you may sustain as a result of any virus in this e-mail. You
    should carry out your own virus checks before opening the e-mail or
    attachment. Infosys reserves the right to monitor and review the content
    of all messages sent to or from this e-mail address. Messages sent to or
    from this e-mail address may be stored on the Infosys e-mail system.
    ***INFOSYS******** End of Disclaimer ********INFOSYS***


    --

    Frank W. Zammetti

    Founder and Chief Software Architect

    Omnytex Technologies

    http://www.omnytex.com

    AIM/Yahoo: fzammetti

    MSN: fzammetti@hotmail.com

    Author of "Practical Ajax Projects With Java Technology"

    (2006, Apress, ISBN 1-59059-695-1)

    Java Web Parts - http://javawebparts.sourceforge.net

    Supplying the wheel, so you don't have to reinvent it!



    ---------------------------------------------------------------------

    To unsubscribe, e-mail: user-unsubscribe@struts.apache.org

    For additional commands, e-mail: user-help@struts.apache.org
  • Frank W. Zammetti at Sep 8, 2006 at 6:09 am
    Ah, your doing something even less typical :)

    There really is no easy way to do this... once your on the client, about
    the only way to generate a PDF would be if the user had Acrobat, or a
    suitable substitute available, one that exposes a print driver (i.e.,
    Print to PDF functionality).

    Two options I can think of... first, is there any reason you have to
    generate the document on the client? If not, I would suggest looking at
    any of the PDF generation packages out there, iText being the one I've
    personally used, and do it on the server. You say "open this
    dynamically generated window". which I take to mean that you pop a new
    window and write to it. If that's correct, how you would do it instead
    is open the window, and set its source to an Action, which does the PDF
    generation. You then write it to the response stream and it will show
    up in the window, assuming the user has a suitable plugin installed.

    Alternatively, you could generate it on the client, but then send the
    result to the server to generate and send back. This is really a pretty
    bad idea IMO, so I'd be going with option A for sure. But again, maybe
    you have some good reason for doing it on the client, in which case I
    doubt you'll find many options... *maybe* an applet that could grab the
    written contents of the document body and generate a PDF, but even that
    would be way more work than it needs to be.

    Generate on the server, that's the simplest and best answer :)

    Frank

    Anjishnu Bandyopadhyay wrote:
    Hi Frank,



    I am generating the HTML page from my JavaScript file through
    "document.writeln()";

    I want to open this dynamically generated window in a PDF document.



    With best regards,

    Anjishnu.





    -----Original Message-----
    From: Frank W. Zammetti
    Sent: Thursday, September 07, 2006 11:22 AM
    To: Struts Users Mailing List
    Subject: Re: Converting HTML content to PDF



    Hi,



    Setting the content type is not sufficient to generate a PDF... are you

    trying to output a PDF from an existing HTML file, or are you

    dynamically generating the HTML? You say you aren't using JSP, so I'm

    thinking your either forwarding to an HTML page, or generating it in

    your Action. While there are HTML to PDF converters, I'm not sure which


    if any could be called from a webapp, and even so, typically dynamically


    generated PDF doesn't make a stop as HTML first, so it might help to

    understand a little better what your trying to do to offer some

    suggestions. But, it is definitely more than just the content type.



    Frank



    Anjishnu Bandyopadhyay wrote:
    Hi all,



    I am trying to programmatically convert an HTML file to pdf
    dynamically;
    by setting the content type. But, I am not being able to succeed.
    Any pointers regarding the same will be of much use.



    Please note that, I am not using a JSP here. (So that, I could be able
    to set the "content" of the "response").



    With best regards,
    Anjishnu.





    **************** CAUTION - Disclaimer *****************
    This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended
    solely for the use of the addressee(s). If you are not the intended
    recipient, please notify the sender by e-mail and delete the original
    message. Further, you are not to copy, disclose, or distribute this
    e-mail or its contents to any other person and any such actions are
    unlawful. This e-mail may contain viruses. Infosys has taken every
    reasonable precaution to minimize this risk, but is not liable for any
    damage you may sustain as a result of any virus in this e-mail. You
    should carry out your own virus checks before opening the e-mail or
    attachment. Infosys reserves the right to monitor and review the content
    of all messages sent to or from this e-mail address. Messages sent to or
    from this e-mail address may be stored on the Infosys e-mail system.
    ***INFOSYS******** End of Disclaimer ********INFOSYS***
    --
    Frank W. Zammetti
    Founder and Chief Software Architect
    Omnytex Technologies
    http://www.omnytex.com
    AIM/Yahoo: fzammetti
    MSN: fzammetti@hotmail.com
    Author of "Practical Ajax Projects With Java Technology"
    (2006, Apress, ISBN 1-59059-695-1)
    Java Web Parts - http://javawebparts.sourceforge.net
    Supplying the wheel, so you don't have to reinvent it!

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
    For additional commands, e-mail: user-help@struts.apache.org
  • MADISHETTY, ASHOK [AG-Contractor/8042] at Sep 8, 2006 at 6:06 am
    Hi,

    Read the below link it may help you to convert HTML to PDF:

    http://www.javaworld.com/javaworld/jw-04-2006/jw-0410-html.html

    Thanks
    Ashok


    -----Original Message-----
    From: Anjishnu Bandyopadhyay
    Sent: Friday, September 08, 2006 11:15 AM
    To: Struts Users Mailing List
    Subject: Converting HTML content to PDF


    Hi all,




    I am trying to programmatically convert an HTML file to pdf dynamically;
    by setting the content type. But, I am not being able to succeed.

    Any pointers regarding the same will be of much use.




    Please note that, I am not using a JSP here. (So that, I could be able
    to set the "content" of the "response").




    With best regards,

    Anjishnu.






    **************** CAUTION - Disclaimer *****************
    This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely
    for the use of the addressee(s). If you are not the intended recipient,
    please notify the sender by e-mail and delete the original message. Further,
    you are not to copy, disclose, or distribute this e-mail or its contents to
    any other person and any such actions are unlawful. This e-mail may contain
    viruses. Infosys has taken every reasonable precaution to minimize this
    risk, but is not liable for any damage you may sustain as a result of any
    virus in this e-mail. You should carry out your own virus checks before
    opening the e-mail or attachment. Infosys reserves the right to monitor and
    review the content of all messages sent to or from this e-mail address.
    Messages sent to or from this e-mail address may be stored on the Infosys
    e-mail system.
    ***INFOSYS******** End of Disclaimer ********INFOSYS***

    ---------------------------------------------------------------------------------------------------------
    This e-mail message may contain privileged and/or confidential information, and is intended to be received only by persons entitled to receive such information. If you have received this e-mail in error, please notify the sender immediately. Please delete it and all attachments from any servers, hard drives or any other media. Other use of this e-mail by you is strictly prohibited.


    All e-mails and attachments sent and received are subject to monitoring, reading and archival by Monsanto. The recipient of this e-mail is solely responsible for checking for the presence of "Viruses" or other "Malware". Monsanto accepts no liability for any damage caused by any such code transmitted by or accompanying this e-mail or any attachment.
    ---------------------------------------------------------------------------------------------------------


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
    For additional commands, e-mail: user-help@struts.apache.org
  • David Friedman at Sep 8, 2006 at 4:50 pm
    Too bad you don't have $69 USD because http://www.easysw.com/htmldoc looks
    promising. Too bad iText doesn't have anything like that yet. Not unless
    you switch to assembling the pages in iText then use the PDF Write or HTML
    Write off that in the last minute.

    Regards,
    David


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
    For additional commands, e-mail: user-help@struts.apache.org
  • Frank W. Zammetti at Sep 8, 2006 at 5:16 pm
    It does look cool, but it doesn't look like it would (easily) solve the
    problem at hand... this is a stand-alone tool (unless I missed the API
    that you can feed a stream to and get a PDF out)... he could write the
    HTML to a temp file and shell out to this, then read the file back and
    output to the stream, but I think we'd all agree that's on the ugly side
    of things :) (and actually, I don't think that would work because its a
    JSP generating the HTML, so the stream is formed... AFAIK, you can't say
    "erase the stream and start again", from a filter let's say, after the
    JSP has rendered, so unless he wants to generate the HTML manually in an
    Action, even shelling out I think wouldn't help).

    Still, a neat little tool, if I ever have to do mass conversions of
    something this could come in handy indeed.

    Frank

    David Friedman wrote:
    Too bad you don't have $69 USD because http://www.easysw.com/htmldoc looks
    promising. Too bad iText doesn't have anything like that yet. Not unless
    you switch to assembling the pages in iText then use the PDF Write or HTML
    Write off that in the last minute.

    Regards,
    David


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
    For additional commands, e-mail: user-help@struts.apache.org



    .
    --
    Frank W. Zammetti
    Founder and Chief Software Architect
    Omnytex Technologies
    http://www.omnytex.com
    AIM/Yahoo: fzammetti
    MSN: fzammetti@hotmail.com
    Author of "Practical Ajax Projects With Java Technology"
    (2006, Apress, ISBN 1-59059-695-1)
    Java Web Parts - http://javawebparts.sourceforge.net
    Supplying the wheel, so you don't have to reinvent it!

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
    For additional commands, e-mail: user-help@struts.apache.org
  • Martin Gainty at Sep 8, 2006 at 5:35 pm
    Frank/David-
    I'm looking at the same sort of idea where an ajax control is desired which will either
    build out a pdf from xml or
    build out a pdf from text
    I have this working fine with FOP from a servlet but the client is *java shy* so I'm looking to package it up and hide the 'gory details' in an Ajax Control
    BTW: Pretty much have to accomplish without timeouts popups and or windows with free advertisements for the vendor..in other words FREE
    (Preferrably as some incantation of Ajaxified Jsp or struts Tag)
    As I dont want to re-invent the wheel so I'll have to ask are there any AJAX controls which accomplish this functionaility?
    Thanks,
    Martin--
    *********************************************************************
    This email message and any files transmitted with it contain confidential
    information intended only for the person(s) to whom this email message is
    addressed. If you have received this email message in error, please notify
    the sender immediately by telephone or email and destroy the original
    message without making a copy. Thank you.

    It does look cool, but it doesn't look like it would (easily) solve the
    problem at hand... this is a stand-alone tool (unless I missed the API
    that you can feed a stream to and get a PDF out)... he could write the
    HTML to a temp file and shell out to this, then read the file back and
    output to the stream, but I think we'd all agree that's on the ugly side
    of things :) (and actually, I don't think that would work because its a
    JSP generating the HTML, so the stream is formed... AFAIK, you can't say
    "erase the stream and start again", from a filter let's say, after the
    JSP has rendered, so unless he wants to generate the HTML manually in an
    Action, even shelling out I think wouldn't help).

    Still, a neat little tool, if I ever have to do mass conversions of
    something this could come in handy indeed.

    Frank

    David Friedman wrote:
    Too bad you don't have $69 USD because http://www.easysw.com/htmldoc looks
    promising. Too bad iText doesn't have anything like that yet. Not unless
    you switch to assembling the pages in iText then use the PDF Write or HTML
    Write off that in the last minute.

    Regards,
    David


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
    For additional commands, e-mail: user-help@struts.apache.org



    .
    --
    Frank W. Zammetti
    Founder and Chief Software Architect
    Omnytex Technologies
    http://www.omnytex.com
    AIM/Yahoo: fzammetti
    MSN: fzammetti@hotmail.com
    Author of "Practical Ajax Projects With Java Technology"
    (2006, Apress, ISBN 1-59059-695-1)
    Java Web Parts - http://javawebparts.sourceforge.net
    Supplying the wheel, so you don't have to reinvent it!

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
    For additional commands, e-mail: user-help@struts.apache.org
  • Frank W. Zammetti at Sep 8, 2006 at 10:11 pm
    Do you mean you want to generate the PDF client-side, to get around the
    no Java requirement of your client? Just want to understand what your
    looking for before I comment :)

    Frank

    Martin Gainty wrote:
    Frank/David-
    I'm looking at the same sort of idea where an ajax control is desired which will either
    build out a pdf from xml or
    build out a pdf from text
    I have this working fine with FOP from a servlet but the client is *java shy* so I'm looking to package it up and hide the 'gory details' in an Ajax Control
    BTW: Pretty much have to accomplish without timeouts popups and or windows with free advertisements for the vendor..in other words FREE
    (Preferrably as some incantation of Ajaxified Jsp or struts Tag)
    As I dont want to re-invent the wheel so I'll have to ask are there any AJAX controls which accomplish this functionaility?
    Thanks,
    Martin--
    *********************************************************************
    This email message and any files transmitted with it contain confidential
    information intended only for the person(s) to whom this email message is
    addressed. If you have received this email message in error, please notify
    the sender immediately by telephone or email and destroy the original
    message without making a copy. Thank you.

    It does look cool, but it doesn't look like it would (easily) solve the
    problem at hand... this is a stand-alone tool (unless I missed the API
    that you can feed a stream to and get a PDF out)... he could write the
    HTML to a temp file and shell out to this, then read the file back and
    output to the stream, but I think we'd all agree that's on the ugly side
    of things :) (and actually, I don't think that would work because its a
    JSP generating the HTML, so the stream is formed... AFAIK, you can't say
    "erase the stream and start again", from a filter let's say, after the
    JSP has rendered, so unless he wants to generate the HTML manually in an
    Action, even shelling out I think wouldn't help).

    Still, a neat little tool, if I ever have to do mass conversions of
    something this could come in handy indeed.

    Frank

    David Friedman wrote:
    Too bad you don't have $69 USD because http://www.easysw.com/htmldoc looks
    promising. Too bad iText doesn't have anything like that yet. Not unless
    you switch to assembling the pages in iText then use the PDF Write or HTML
    Write off that in the last minute.

    Regards,
    David


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
    For additional commands, e-mail: user-help@struts.apache.org



    .
    --
    Frank W. Zammetti
    Founder and Chief Software Architect
    Omnytex Technologies
    http://www.omnytex.com
    AIM/Yahoo: fzammetti
    MSN: fzammetti@hotmail.com
    Author of "Practical Ajax Projects With Java Technology"
    (2006, Apress, ISBN 1-59059-695-1)
    Java Web Parts - http://javawebparts.sourceforge.net
    Supplying the wheel, so you don't have to reinvent it!

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
    For additional commands, e-mail: user-help@struts.apache.org
    --
    Frank W. Zammetti
    Founder and Chief Software Architect
    Omnytex Technologies
    http://www.omnytex.com
    AIM/Yahoo: fzammetti
    MSN: fzammetti@hotmail.com
    Author of "Practical Ajax Projects With Java Technology"
    (2006, Apress, ISBN 1-59059-695-1)
    Java Web Parts - http://javawebparts.sourceforge.net
    Supplying the wheel, so you don't have to reinvent it!

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
    For additional commands, e-mail: user-help@struts.apache.org
  • Anjishnu Bandyopadhyay at Sep 8, 2006 at 6:18 am
    Hi Frank,



    Thanks for your suggestion.



    My actual requirement is to display the print preview of the contents of
    the original page in the dynamically generated popup html page. For
    this, I am reading the contents of the parent page through "innerHTML"
    and outputting the contents in the popup (through document.write).

    Now, in IE, by default, the background color is not printed unless you
    explicitly set the same in the settings. But our client does not want
    each and every user to change the setting manually.

    So, they have suggested this approach of sending the data to PDF,
    instead of HTML.



    With best regards,

    Anjishnu.



    -----Original Message-----
    From: Frank W. Zammetti
    Sent: Thursday, September 07, 2006 11:34 AM
    To: Struts Users Mailing List
    Subject: Re: Converting HTML content to PDF



    Ah, your doing something even less typical :)



    There really is no easy way to do this... once your on the client, about


    the only way to generate a PDF would be if the user had Acrobat, or a

    suitable substitute available, one that exposes a print driver (i.e.,

    Print to PDF functionality).



    Two options I can think of... first, is there any reason you have to

    generate the document on the client? If not, I would suggest looking at


    any of the PDF generation packages out there, iText being the one I've

    personally used, and do it on the server. You say "open this

    dynamically generated window". which I take to mean that you pop a new

    window and write to it. If that's correct, how you would do it instead

    is open the window, and set its source to an Action, which does the PDF

    generation. You then write it to the response stream and it will show

    up in the window, assuming the user has a suitable plugin installed.



    Alternatively, you could generate it on the client, but then send the

    result to the server to generate and send back. This is really a pretty


    bad idea IMO, so I'd be going with option A for sure. But again, maybe

    you have some good reason for doing it on the client, in which case I

    doubt you'll find many options... *maybe* an applet that could grab the

    written contents of the document body and generate a PDF, but even that

    would be way more work than it needs to be.



    Generate on the server, that's the simplest and best answer :)



    Frank



    Anjishnu Bandyopadhyay wrote:
    Hi Frank,
    >

    >

    >
    I am generating the HTML page from my JavaScript file through
    "document.writeln()"; >
    I want to open this dynamically generated window in a PDF document.
    >

    >

    >
    With best regards, >
    Anjishnu.
    >

    >

    >

    >

    >
    -----Original Message-----
    From: Frank W. Zammetti
    Sent: Thursday, September 07, 2006 11:22 AM
    To: Struts Users Mailing List
    Subject: Re: Converting HTML content to PDF
    >

    >

    >
    Hi,
    >

    >

    >
    Setting the content type is not sufficient to generate a PDF... are
    you

    >
    trying to output a PDF from an existing HTML file, or are you >
    dynamically generating the HTML? You say you aren't using JSP, so I'm

    >
    thinking your either forwarding to an HTML page, or generating it in >
    your Action. While there are HTML to PDF converters, I'm not sure
    which

    >

    >
    if any could be called from a webapp, and even so, typically
    dynamically

    >

    >
    generated PDF doesn't make a stop as HTML first, so it might help to >
    understand a little better what your trying to do to offer some >
    suggestions. But, it is definitely more than just the content type.
    >

    >

    >
    Frank
    >

    >

    >
    Anjishnu Bandyopadhyay wrote:
    >
    Hi all,
    >

    >

    >

    >

    >
    I am trying to programmatically convert an HTML file to pdf
    dynamically;
    >
    by setting the content type. But, I am not being able to succeed.
    >

    >
    Any pointers regarding the same will be of much use.
    >

    >

    >

    >

    >
    Please note that, I am not using a JSP here. (So that, I could be
    able

    >
    to set the "content" of the "response").
    >

    >

    >

    >

    >
    With best regards,
    >

    >
    Anjishnu.
    >

    >

    >

    >

    >

    >

    >
    **************** CAUTION - Disclaimer *****************
    >
    This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended
    solely for the use of the addressee(s). If you are not the intended
    recipient, please notify the sender by e-mail and delete the original
    message. Further, you are not to copy, disclose, or distribute this
    e-mail or its contents to any other person and any such actions are
    unlawful. This e-mail may contain viruses. Infosys has taken every
    reasonable precaution to minimize this risk, but is not liable for any
    damage you may sustain as a result of any virus in this e-mail. You
    should carry out your own virus checks before opening the e-mail or
    attachment. Infosys reserves the right to monitor and review the content
    of all messages sent to or from this e-mail address. Messages sent to or
    from this e-mail address may be stored on the Infosys e-mail system.
    >
    ***INFOSYS******** End of Disclaimer ********INFOSYS***
    >

    >

    >



    --

    Frank W. Zammetti

    Founder and Chief Software Architect

    Omnytex Technologies

    http://www.omnytex.com

    AIM/Yahoo: fzammetti

    MSN: fzammetti@hotmail.com

    Author of "Practical Ajax Projects With Java Technology"

    (2006, Apress, ISBN 1-59059-695-1)

    Java Web Parts - http://javawebparts.sourceforge.net

    Supplying the wheel, so you don't have to reinvent it!



    ---------------------------------------------------------------------

    To unsubscribe, e-mail: user-unsubscribe@struts.apache.org

    For additional commands, e-mail: user-help@struts.apache.org
  • Frank W. Zammetti at Sep 8, 2006 at 3:34 pm
    Ok, I understand the requirement... Seems like a lot of trouble to go
    through to solve it, but I understand, if that's what the client says to
    do, you do it.

    However, I don't see any good way to do it... Hmm... if I remember
    correctly, filters fire AFTER a JSP is interpreted, if you set it up as
    a post-processing filter... in that case, you may be able to take the
    response stream and find some library that can take it and make a PDF
    out of it... I think someone else referenced an article detailing using
    FOP for HTML to PDF... as long as you ensure that the output of your JSP
    is XHTML, you can skip that step in that tutorial, and go right to PDF
    generation. Do all this from a filter and I *think* you can do what you
    need to... I think what you'll have is you do whatever you do now, where
    the user sees the page to be printed... then, add some Javascript that
    fires onLoad that opens a new window and sets is href to the mapping
    that generates that HTML again, but this time with the filter mapped to
    it. Then do the PDF work in the filter.

    The result should be that when the user navigates to that page, they
    will see the page in the main browser window, and will also get a popup
    window that, after a second or three, displays the same page in PDF
    format.

    Does that all make sense? It's a fair bit of work, but I'm not sure
    there's too many alternatives if your client really needs this feature.

    Frank

    Anjishnu Bandyopadhyay wrote:
    Hi Frank,



    Thanks for your suggestion.



    My actual requirement is to display the print preview of the contents of
    the original page in the dynamically generated popup html page. For
    this, I am reading the contents of the parent page through "innerHTML"
    and outputting the contents in the popup (through document.write).

    Now, in IE, by default, the background color is not printed unless you
    explicitly set the same in the settings. But our client does not want
    each and every user to change the setting manually.

    So, they have suggested this approach of sending the data to PDF,
    instead of HTML.



    With best regards,

    Anjishnu.



    -----Original Message-----
    From: Frank W. Zammetti
    Sent: Thursday, September 07, 2006 11:34 AM
    To: Struts Users Mailing List
    Subject: Re: Converting HTML content to PDF



    Ah, your doing something even less typical :)



    There really is no easy way to do this... once your on the client, about


    the only way to generate a PDF would be if the user had Acrobat, or a

    suitable substitute available, one that exposes a print driver (i.e.,

    Print to PDF functionality).



    Two options I can think of... first, is there any reason you have to

    generate the document on the client? If not, I would suggest looking at


    any of the PDF generation packages out there, iText being the one I've

    personally used, and do it on the server. You say "open this

    dynamically generated window". which I take to mean that you pop a new

    window and write to it. If that's correct, how you would do it instead

    is open the window, and set its source to an Action, which does the PDF

    generation. You then write it to the response stream and it will show

    up in the window, assuming the user has a suitable plugin installed.



    Alternatively, you could generate it on the client, but then send the

    result to the server to generate and send back. This is really a pretty


    bad idea IMO, so I'd be going with option A for sure. But again, maybe

    you have some good reason for doing it on the client, in which case I

    doubt you'll find many options... *maybe* an applet that could grab the

    written contents of the document body and generate a PDF, but even that

    would be way more work than it needs to be.



    Generate on the server, that's the simplest and best answer :)



    Frank



    Anjishnu Bandyopadhyay wrote:
    Hi Frank,

    I am generating the HTML page from my JavaScript file through
    "document.writeln()";
    I want to open this dynamically generated window in a PDF document.

    With best regards,
    Anjishnu.


    -----Original Message-----
    From: Frank W. Zammetti
    Sent: Thursday, September 07, 2006 11:22 AM
    To: Struts Users Mailing List
    Subject: Re: Converting HTML content to PDF

    Hi,

    Setting the content type is not sufficient to generate a PDF... are
    you

    trying to output a PDF from an existing HTML file, or are you
    dynamically generating the HTML? You say you aren't using JSP, so I'm
    thinking your either forwarding to an HTML page, or generating it in
    your Action. While there are HTML to PDF converters, I'm not sure
    which


    if any could be called from a webapp, and even so, typically
    dynamically


    generated PDF doesn't make a stop as HTML first, so it might help to
    understand a little better what your trying to do to offer some
    suggestions. But, it is definitely more than just the content type.

    Frank

    Anjishnu Bandyopadhyay wrote:
    Hi all,




    I am trying to programmatically convert an HTML file to pdf
    dynamically;
    by setting the content type. But, I am not being able to succeed.
    Any pointers regarding the same will be of much use.




    Please note that, I am not using a JSP here. (So that, I could be
    able

    to set the "content" of the "response").




    With best regards,
    Anjishnu.






    **************** CAUTION - Disclaimer *****************
    This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended
    solely for the use of the addressee(s). If you are not the intended
    recipient, please notify the sender by e-mail and delete the original
    message. Further, you are not to copy, disclose, or distribute this
    e-mail or its contents to any other person and any such actions are
    unlawful. This e-mail may contain viruses. Infosys has taken every
    reasonable precaution to minimize this risk, but is not liable for any
    damage you may sustain as a result of any virus in this e-mail. You
    should carry out your own virus checks before opening the e-mail or
    attachment. Infosys reserves the right to monitor and review the content
    of all messages sent to or from this e-mail address. Messages sent to or
    from this e-mail address may be stored on the Infosys e-mail system.
    ***INFOSYS******** End of Disclaimer ********INFOSYS***

    --
    Frank W. Zammetti
    Founder and Chief Software Architect
    Omnytex Technologies
    http://www.omnytex.com
    AIM/Yahoo: fzammetti
    MSN: fzammetti@hotmail.com
    Author of "Practical Ajax Projects With Java Technology"
    (2006, Apress, ISBN 1-59059-695-1)
    Java Web Parts - http://javawebparts.sourceforge.net
    Supplying the wheel, so you don't have to reinvent it!

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
    For additional commands, e-mail: user-help@struts.apache.org

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriesstruts
postedSep 8, '06 at 5:45a
activeJan 28, '09 at 3:27p
posts23
users11
websitestruts.apache.org
irc#struts

People

Translate

site design / logo © 2022 Grokbase