Announcement

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

    Chrome cannot export large grids to PDF

    Tested in SmartClient_v101p_2016-03-16_PowerEdition, Chrome 45

    We utilize the PDF export functionality in the grid. Users have been noticing that large grids cannot be exported to PDF. Below is the test case. However, this functionality works in IE 11.

    Since it seems like the generated HTML is too large, I compared browsers and SMartCLient versions:

    SmartClient 10.1 - IE11: 49,721
    SMartClient 10.1 - Chrome: 104,921
    SmartClient 10.1 - Firefox: 57,586

    Is there any reason why Chrome is more than twice as large as IE11? What can we do to resolve this issue? (It may be server related, but in any case what would some workarounds be?)

    REPRO Steps
    =============
    1. Load the test case in Chrome. The attached data file must be renamed to .json.
    2. Click the export button
    3. Observe the console error (attached).
    4. Observe the server log:
    === 2016-03-17 18:27:03,356 [80-4] INFO PdfExport - CharSet used: UTF-8
    === 2016-03-17 18:27:04,772 [80-2] INFO RequestContext - URL: '/isomorphic/skins/EnterpriseBlue/images/ListGrid/group_opened.png', User-Agent: 'Java/1.7.0_25': Unsupported WITHOUT Accept-En
    coding header
    === 2016-03-17 18:27:04,784 [80-2] INFO Download - done streaming: C:/development/SmartClient/releases/SmartClient_v101p_2016-03-16_PowerEdition/smartclientSDK/isomorphic/skins/EnterpriseBl
    ue/images/ListGrid/group_opened.png
    === 2016-03-17 18:27:04,949 [80-4] INFO ProxyHttpServletResponse - content-disposition set to: attachment;filename=export.pdf - unwrapping response output stream (CompressionFilter)
    === 2016-03-17 18:27:05,227 [80-4] DEBUG RPCDMI - rpc returned data
    === 2016-03-17 18:28:06,458 [80-4] INFO RequestContext - URL: '/isomorphic/IDACall', User-Agent: 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564
    .116 Safari/537.36': Safari with Accept-Encoding header
    === 2016-03-17 18:28:06,459 [80-4] WARN RPCManager - Unexpected empty RPCManager transaction: POST'd data appears to have been removed from the request before the server framework received
    it. This may be due to application / server settings restricting maximum POST / file upload size, or due to security software on your server, browser or network that erroneously blocked the
    request, or due to bugs in servlet filters.
    === 2016-03-17 18:28:06,459 [80-4] INFO Compression - /isomorphic/IDACall: 93 -> 101 bytes
    Code:
    <!DOCTYPE html>
    
    <html>
        <head>
    
            <title></title>
            
            <style>
                .diagInfo {
                    font-size: 14px;
                    font-weight: bold;
                    padding: 5px;
                }
            </style>
            
            <script type="text/javascript" SRC="http://localhost:8080/isomorphic/system/modules/ISC_Core.js"></script>
            <script type="text/javascript" SRC="http://localhost:8080/isomorphic/system/modules/ISC_Foundation.js"></script>
            <script type="text/javascript" SRC="http://localhost:8080/isomorphic/system/modules/ISC_Containers.js"></script>
            <script type="text/javascript" SRC="http://localhost:8080/isomorphic/system/modules/ISC_Grids.js"></script>
            <script type="text/javascript" SRC="http://localhost:8080/isomorphic/system/modules/ISC_Forms.js"></script>
            <script type="text/javascript" SRC="http://localhost:8080/isomorphic/system/modules/ISC_DataBinding.js"></script>
            <script type="text/javascript" SRC="http://localhost:8080/isomorphic/system/modules/ISC_Drawing.js"></script>
            <script type="text/javascript" SRC="http://localhost:8080/isomorphic/system/modules/ISC_PluginBridges.js"></script>
            <script type="text/javascript" SRC="http://localhost:8080/isomorphic/system/modules/ISC_Charts.js"></script>    
            <script type="text/javascript" SRC="http://localhost:8080/isomorphic/skins/EnterpriseBlue/load_skin.js"></script>
        
            <script type="text/javascript" >
                var isomorphicDir="http://localhost:8080/isomorphic/";
                
                // set this to the correct JIRA ticket
                var JIRA_TICKET = "SNTQ-1219";
                
                isc.DataSource.create({
                ID: "countryDS",
                dataURL: "SNQA-1219.json",
                fields:[
                    {name:"continent", title:"Continent"},
                    {name:"countryCode", title:"Code"},
                    {name:"countryName", title:"Country"},
                    {name:"capital", title:"Capital"},
                    {name:"area", title:"Area"},
                    {name:"population", title:"Population"},
                    {name:"gdp", title:"Gdp"},
                    {name:"government", title:"Government"},
                    {name:"member_g8", title:"Member of G8"},
                    {name:"article", title:"Article"}
                ],
                dataFormat: "json",
                clientOnly: true
    
                })
            
                
                // once page loads set some diagnostic information, DO NOT CHANGE
                isc.Page.setEvent("load", function() {
                    document.title = JIRA_TICKET + "   (SmartClient version " + isc.versionNumber + ")";
                    var html = [];
                    html.push("Jira: " + JIRA_TICKET);
                    html.push("SmartClient: " + isc.versionNumber);
                    html.push("Browser: " + navigator.appCodeName + " " + navigator.appName + " " + navigator.appVersion);
                    diagLabel.setContents( html.join("<br>"));
                });
                
                
                
    
            </script>
    
    </head>
        
        <body>
            <script>
            
                // ===== DO NOT REMOVE =====
                var diagLabel = isc.Label.create({
                            ID: "diagInfo",
                            width: "100%",
                            styleName: "diagInfo",
                            autoFit: true
                        });
                // ===== DO NOT REMOVE =====
                            
                // basic grid        
                var grid = isc.ListGrid.create({
                    dataSource: countryDS,
                    dataFetchMode : "local",
    autoFetchData:true,
                    position: "relative",
                    width : "100%",
                    align : "center",
                    autoFitData : "vertical",
                    autoFitMaxHeight : 400,
                    alternateRecordStyles : true,
                    canAddFormulaFields : true,
                    canAddSummaryFields : true,
                    canGroupBy : true,
                    canReorderFields : true,
                    showGroupSummary : true,
                    groupByMaxRecords : 1000,
                    useAdvancedFieldPicker: true,
                    advancedFieldPickerThreshold: 5,
                    autoDraw: false
                });    
                
                    
                // the main page layout - place all other components afetr diagLabel
                var layout = isc.VLayout.create({
                    width:"100%",
                    membersMargin: 20,
                    members: [
                        // ===== DO NOT REMOVE diagLabel
                        diagLabel,
                        grid,
                        isc.IButton.create({
                            ID : "buttonPdf",
                            width: 150,
                            title:"Export",  
                            click:function () {
                                isc.warn("Exporting " + countryDS.cacheData.length + " records");
                                grid.groupTree.openAll();
                                var settings = {
                                    skinName: "Enterprise",
                                    pdfName: "export"// without .pdf
                                };
                                
                                isc.RPCManager.exportContent(grid, settings);
                            }
                        }),
                        isc.IButton.create({
                            ID : "buttonSize",
                            width: 150,
                            title:"Get Size",  
                            click:function () {
                            
                                var gridHTML = grid.getPrintHTML({
                                    printForExport : true
                                });
                                if (gridHTML == null)
                                    grid.getPrintHTML({    printForExport : true },
                                         function(html) { console.log("Size=" + html.length); });
                                else
                                    console.log("Size=" + gridHTML.length);
        
                            }
                        })
                        // ===== place anty components here
        
                    ]
                });
                    
                    grid.groupBy("countryCode");
                    
            </script>
    
        </body>
    
    </html>

    #2
    Adding attachments. Please rename .txt to .zip, unzip, then rename to .json.
    Attached Files

    Comment


      #3
      As the log says, this is your server dropping the transmitted information before it reaches the SmartClient Server libraries. There's nothing we can do about that, you have to change configuration settings for your server. For Tomcat, there's a simple way to set maximum post size in an XML file - you'll need to Google the procedure for whatever you're using.

      About the size differences, please let us know exactly what tool or approach you used to get those numbers. We will probably also need to see the HTTP request headers and the .html file that posted the data.

      Comment


        #4
        The test case shows how I got the numbers, basically I am simply logging the length of the html generated from the grid using the getPrintHTML() method. I know it doesn't include any other size information such as headers, as the issue seems to be with the size of the generated HTML.

        Comment


          #5
          We see the problem here, and a fix is in testing - should hit tomorrow's builds, but we'll update if that isn't going to happen.

          Comment


            #6
            The fix for this did not make it into today's builds - but it's now in the codebase and will hit builds tomorrow.

            Comment

            Working...
            X