Database Report Generation For The Web
Formatting Reports Using PDF
By Joe Hughes
As corporate developers begin migrating existing database applications to the Web, they'll likely run into a roadblock when it comes to report generation. One problem is that HTML was not designed with printers in mind, so it doesn't currently support features like page headers and footers.
A browser can scroll forever. So, if you attempt to put a footer into an HTML document containing the equivalent of two 8.5"x11" printed pages, the footer will only appear on the second printed page. Also, the first page will contain a header, but the second will not. You can attempt to put in a header and footer where you think each page should start and end, but this is a fool's errand. Since browsers are cross-platform and you have no real font control, the report will look nice in one browser, but not in another. You could attempt to create a GIF file for each report page, but then the output is guaranteed to be jagged, since GIF is not a vector format.
Even if you can ignore the header/footer issue, HTML tables are notoriously difficult to print. Most browsers, including Netscape, have a hard time breaking up wide tables. For example, let's say that 15 out of 30 columns of data fit on a printed page. Not all browser print engines are smart enough to put the right-most columns on the next page. Some browsers simply lop off the table. Even smart browsers may split the page down the middle of the right-most column, making the next page look awful. Changing the page orientation in the browser's print setup only delays the inevitable page overrun, and then you have set your orientation for all pages.