Forum Replies Created

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • in reply to: need servlet code for converting html string to pdf
    #29036

    i think the problem is url is not able to read because of session. the xhtml in url shown is generated through the code and then user can view the report through that url.
    do you have any suggestions how to handle this case with the session?

    Prashant.

    in reply to: need servlet code for converting html string to pdf
    #29035

    Hello,
    i am using pd4ml 3.8.0fx4 version

    in reply to: need servlet code for converting html string to pdf
    #29033

    Hello,
    I tried to run above code in my applicayion which is a JSF enabled application.while trying to convert given URL i get the following exception.

    java.lang.NullPointerException
    org.zefer.pd4ml.PD4ML.o00000(Unknown Source)
    org.zefer.pd4ml.PD4ML.render(Unknown Source)
    com.xyz.report.jsf.HtmlToPDF.doGet(HtmlToPDF.java:38)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    com.xyz.servlet.BaseEntityFilter.doFilter(BaseEntityFilter.java:44)

    my code is

    public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
    
    URL url = new URL("http://localhost:8080/xyzweb/faces/templates/includes/report/A104_fv_1.xhtml");
    
    PD4ML pd4ml = new PD4ML();
    
    pd4ml.setPageSize( PD4Constants.A4 );
    pd4ml.setPageInsets( new java.awt.Insets(20, 50, 10, 10) );
    pd4ml.setHtmlWidth(1000);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    pd4ml.render(url, baos);
    //pd4ml.render(arg0, arg1)
    byte[] result = baos.toByteArray();
    
    response.setContentType("application/pdf");
    response.setHeader("Content-disposition","inline; filename=test.pdf");
    response.setHeader("Pragma", "cache");
    response.setHeader("Expires", "0");
    response.setHeader("Cache-control", "private");
    
    response.setContentLength(result.length);
    ServletOutputStream sos = response.getOutputStream();
    sos.write( result );
    }

    in reply to: pd4ml for jsp deployment in tomcat 6.0 is not working
    #29022

    ok solved, no need to remove the jars..
    actually problem was in tomcat 6.0
    need to add jasper-el.jar to tomact/lib

    code works fine now.

    thank you!

    Prashant

Viewing 4 posts - 1 through 4 (of 4 total)