Grid-To-PDF versus Chrome and Firefox

I have successfully implemented the grid-to-pdf feature – looks really great in IE. But, in Chrome and Firefox the results are less glamorous,

In Chrome, the new window opens up and, instead of a PDF, there is

As for Firefox… well, I’m still waiting to learn. After 15 minutes it still displays a new, empty window with “Loading…” in the title.

IE version 8
Chrome version 5
Firefox version 3.6

You can try to update dhtmlxgrid_export.js with attached one.

If it still doesn’t fix the issue - can you provide sample of XML data from problematic grid?
dhtmlxgrid_export.zip (4.59 KB)

This new file has improved matters somewhat. The PDF is now generated successfully (in all three standard color options) in both IE and Firefox. In Chrome, however, no PDF is generated. An error file is created in the ./server directory (error_report_yyyy_mm_dd__hh_mm_ss.xml) but it’s completely empty.

FYI … the same symptoms are evident for the grid.toExcel method. I.e., works in latest IE and Firefox, but not Chrome 5.

Problem was confirmed and fixed.
Please try to use attached js file instead of original one
( the same fix will be added to the next version of dhtmlxgrid )
dhtmlxgrid_export4.zip (4.57 KB)

Indeed some improvement. Still works as it should in IE and Firefox, but there is still a problem when using Chrome. It seems that repeated invocations fail in Chrome. By this I mean, if I request a PDF, and then follow it with another request, the subsequent one fails, as will all additional attempts. The same symptoms apply to the Grid-to-Excel feature. It is interesting to note, however, that if requests for PDF and Excel are intemingled, the problem will briefly go away. Suppose the following sequence: (1) PDF, (2) PDF, (3) PDF, (4) PDF, (5) Excel, (6) PDF, (7) PDF. #2, #3, #4, and #7 will fail, whereas #1, #5, and #6 will succeed. The same pattern is present if you invert the actions: (1) Excel, (2) Excel, (3) Excel, (4) Excel, (5) PDF, (6) Excel, (7) Excel. Again, #2, #3, #4, and #7 will fail, whereas numbers #1, #5, and #6 will succeed.

Its quite strange, update script works locally for sure ( we was able to reconstruct previous problem, but now all looks correctly )

Does it generate error report or die silently ?
Is problem occurs for different PC as well ? ( maybe caused by some specific chrome configuration )

I’m puzzled as well. I threw together a small test program and, like as for you, it works fine. Repeated, successive PDF requests work with no problem. So, I dug deeper, trying to learn a little about how the whole process works. I must admit I’m out of my depth, but at one point I modified the start of generate.php to be as follows:require_once 'gridPdfGenerator.php'; echo "<html><body>before require_once gridPdfGenerator.pdf</body></html>"; exit; to see what would happen when I tried my original program. Indeed the the first time I got a page consisting of nothing more that “before require_once gridPdfGenerator.pdf”. When I then immediately tried to print again, I got nothing at all. (I also confirmed that the grid xml that’s passed to generate.php is in fact the same each time, so it would not seem there’s any issues related to dhtmlxgri_export.js). I must ask – is there any possibility of conflicting PHP variable names between the various export programs and a program a user (an ignorant one such as myself) might write? I.e., is there something “left over” after the first PDF request that causes the subsequent one to fail?

The export tools classes doesn’t use any global variables, so I don’t see how they can be affected by some other code.

Problem may be in some kind of server caching or server configuration
Can you try the same code on different php installation?