Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Error in PDF Export

    Hi Support Team,

    We are licensed users of SmartGWT. version : 'v11.0p_2019-06-05/Enterprise Deployment'


    We are getting beow exception when we try to export grid content to PDF. Same code works on different pages. We see the same error on successful export as well.

    But it failed on some.
    ----------------------Error----------


    java.io.IOException: Stream closed
    14:13:22,534 INFO [STDOUT] at java.io.BufferedInputStream.getInIfOpen(BufferedInputStream.java:159)
    14:13:22,534 INFO [STDOUT] at java.io.BufferedInputStream.read1(BufferedInputStream.java:284)
    14:13:22,534 INFO [STDOUT] at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
    14:13:22,534 INFO [STDOUT] at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
    14:13:22,534 INFO [STDOUT] at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
    14:13:22,534 INFO [STDOUT] at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
    14:13:22,534 INFO [STDOUT] at java.io.InputStreamReader.read(InputStreamReader.java:184)
    14:13:22,534 INFO [STDOUT] at org.xhtmlrenderer.css.parser.Lexer.zzRefill(Lexer.java:1634)
    14:13:22,534 INFO [STDOUT] at org.xhtmlrenderer.css.parser.Lexer.yylex(Lexer.java:1865)
    14:13:22,534 INFO [STDOUT] at org.xhtmlrenderer.css.parser.CSSParser.next(CSSParser.java:1798)
    14:13:22,534 INFO [STDOUT] at org.xhtmlrenderer.css.parser.CSSParser.la(CSSParser.java:1810)
    14:13:22,534 INFO [STDOUT] at org.xhtmlrenderer.css.parser.CSSParser.stylesheet(CSSParser.java:159)
    14:13:22,534 INFO [STDOUT] at org.xhtmlrenderer.css.parser.CSSParser.parseStylesheet(CSSParser.java:89)
    14:13:22,803 INFO [STDOUT] at org.xhtmlrenderer.context.StylesheetFactoryImpl.parse(StylesheetFactoryImpl.java:78)
    14:13:22,803 INFO [STDOUT] at org.xhtmlrenderer.context.StylesheetFactoryImpl.parse(StylesheetFactoryImpl.java:95)
    14:13:22,803 INFO [STDOUT] at org.xhtmlrenderer.context.StylesheetFactoryImpl.getStylesheet(StylesheetFactoryImpl.java:174)
    14:13:22,803 INFO [STDOUT] at org.xhtmlrenderer.context.StyleReference.readAndParseAll(StyleReference.java:123)
    14:13:22,803 INFO [STDOUT] at org.xhtmlrenderer.context.StyleReference.setDocumentContext(StyleReference.java:107)
    14:13:22,803 INFO [STDOUT] at org.xhtmlrenderer.pdf.ITextRenderer.setDocument(ITextRenderer.java:175)
    14:13:22,803 INFO [STDOUT] at org.xhtmlrenderer.pdf.ITextRenderer.setDocument(ITextRenderer.java:142)
    14:13:22,803 INFO [STDOUT] at com.isomorphic.contentexport.PdfExport.getPdfRenderer(PdfExport.java:346)
    14:13:22,803 INFO [STDOUT] at com.isomorphic.contentexport.PdfExport.getPdfObject(PdfExport.java:76)
    14:13:22,803 INFO [STDOUT] at com.isomorphic.rpc.BuiltinRPC.getPdfObject(BuiltinRPC.java:1159)
    14:13:22,803 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    14:13:22,803 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    14:13:22,803 INFO [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    14:13:22,803 INFO [STDOUT] at java.lang.reflect.Method.invoke(Method.java:498)
    14:13:22,803 INFO [STDOUT] at com.isomorphic.base.Reflection.adaptArgsAndInvoke(Reflection.java:966)
    14:13:22,803 INFO [STDOUT] at com.isomorphic.base.Reflection.adaptArgsAndInvoke(Reflection.java:796)
    14:13:22,803 INFO [STDOUT] at com.isomorphic.rpc.RPCDMI.execute(RPCDMI.java:329)
    14:13:22,803 INFO [STDOUT] at com.isomorphic.rpc.RPCDMI.execute(RPCDMI.java:67)
    14:13:22,803 INFO [STDOUT] at com.isomorphic.rpc.RPCRequest.execute(RPCRequest.java:249)
    14:13:22,803 INFO [STDOUT] at com.isomorphic.servlet.IDACall.handleRPCRequest(IDACall.java:355)
    14:13:22,803 INFO [STDOUT] at com.isomorphic.servlet.IDACall.processRPCTransaction(IDACall.java:184)
    14:13:22,803 INFO [STDOUT] at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:152)
    14:13:22,803 INFO [STDOUT] at com.isomorphic.servlet.IDACall._processRequest(IDACall.java:119)
    14:13:22,803 INFO [STDOUT] at com.isomorphic.servlet.IDACall.doPost(IDACall.java:79)
    14:13:22,803 INFO [STDOUT] at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    14:13:22,803 INFO [STDOUT] at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:162)

    ------------------------------------
    Code

    Below is the code we used.


    export.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {


    @Override

    public void onClick(

    com.smartgwt.client.widgets.events.ClickEvent event) {

    DSRequest req = new DSRequest();

    req.setAttribute("skinName", "Enterprise");

    req.setAttribute("pdfName", "Export_" + fileName);

    RPCManager.exportContent(listGrid, req);

    }

    });
    Attached Files
    Last edited by revanbhapri; 8 Mar 2024, 03:31.

    #2
    The stack indicates that, during the reading of a CSS file required for rendering the PDF, the stream unexpectedly closes. This isn't a bug in our software, but we can give you some pointers.

    Take a look at the docs for exportContent() to understand what CSS may be involved. The likely problem here is that, on the pages that have a problem with the export, the CSS file is not able to be fetched by the server-side logic inside of iText (the PDF generation library).

    If you can't figure out the problem from just looking at what's unique about the CSS references on that page (and/or in this particular exportContent() call), then a network sniffer would be able to show you the requests issued by the server that are failing.

    Comment


      #3
      Thanks for your response. I found the cause and fixed it..

      Comment

      Working...
      X