PaperTiger Posted January 2, 2014 Share Posted January 2, 2014 Hi, We have various reports which can be printed off by our staff, for each individual student, which work by generating a simple HTML page and then using the javascript print method on the document load to print it off (or Ctrl+P, whatever it's just a normal HTML page). Pretty standard and simple. However, one of the managers has decided in his infinite wisdom and obsession with printing everything that he can, that he wants to have one button which he can click to print off all reports for every student in the system. Now since these reports are generated at run time, building up the HTML page, I can't see any way to do this other than literally have it create one massively long HTML page with all the reports, which will no doubt take hours and hours to load, and then just print in the normal way. Is there any other way this could be achieved? The only other thing I can think of at the moment is change it so that when a report is generated it saves a copy to a file somewhere, but even then it would still have to load it up in order to use the javascript print method, and there would be plenty of reports that won't have been run yet, so they would still need to be generated, and as php is server side I am 99% sure there's no way for it to communicate with the client's printer to just say "print all these things". Any ideas at all? Cheers. Quote Link to comment Share on other sites More sharing options...
trq Posted January 2, 2014 Share Posted January 2, 2014 We used to generate all reports as PDF. These can be concatenated together and printed that way. Printing html reports sounds unreliable at best. Quote Link to comment Share on other sites More sharing options...
PaperTiger Posted January 2, 2014 Author Share Posted January 2, 2014 I originally had them generated as PDF documents, but found it to be very unreliable no matter what library I used, and it didn't work cross browser either, so I went back to HTML. If they were generated as PDFs though, surely it would run into the same issue of having to sit there loading up an enormous file for hours on end before it would actually print off? Quote Link to comment Share on other sites More sharing options...
kicken Posted January 2, 2014 Share Posted January 2, 2014 It would still take time to generate the file. Depending on what kind of setup you have, you may be able to send the file to the printer after generation rather than download it and print it locally. For one of our mass-print setups we do as mentioned by trq. Each report is generated as a PDF and the user can choose to either download/print the reports individually or select a bunch of them and download/print all. The download/print all simply merges the individual PDF's into a single large PDF and then sends it to the browser. Quote Link to comment Share on other sites More sharing options...
trq Posted January 3, 2014 Share Posted January 3, 2014 I should also have mentioned that we had a custom applet written in Java that enabled us to stream these pdfs to a printer without ever loading into the browser. I don't work at that place any more and the framework I wrote (php api) to do this isn't open source, but it was all built on top of Jasper Reports. You mention "students" which is funny because the company I built this for build administration applications for schools. Our system was capable of producing (and printing) school reports for every student within a year at a time. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.