Creating Printable, Multi-paged Reports from SQL Query

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Venona69
Forum Newbie
Posts: 1
Joined: Wed Aug 18, 2004 6:57 pm

Creating Printable, Multi-paged Reports from SQL Query

Post by Venona69 »

Hi!

I'm generating several "report" pages with a combination of SQL queries that result in pages of varying length depending on the SQL output. My client needs these pages to be printable and has requested that I figure out how to create "page breaks" when printed. I have to display header/footer info for each "page" and they'd like page numbering as well. I've just started messing with PDF generation, and while this seems like the way to go, its very tedious, especially when dealing with dynamic data (as from a db query). Anyone have any ideas for "paging" html output with PHP other than through PDF generation? Any help is GREATLY appreciated!
foobar
Forum Regular
Posts: 613
Joined: Wed Sep 28, 2005 10:08 am

Re: Creating Printable, Multi-paged Reports from SQL Query

Post by foobar »

Venona69 wrote:Hi!

I'm generating several "report" pages with a combination of SQL queries that result in pages of varying length depending on the SQL output. My client needs these pages to be printable and has requested that I figure out how to create "page breaks" when printed. I have to display header/footer info for each "page" and they'd like page numbering as well. I've just started messing with PDF generation, and while this seems like the way to go, its very tedious, especially when dealing with dynamic data (as from a db query). Anyone have any ideas for "paging" html output with PHP other than through PDF generation? Any help is GREATLY appreciated!
One thing I can imagine using PDF is to send content with the PDF MIME-Type (whatever it is) to the browser. That way you won't have to create files.

Otherwise, there's no way you can ensure that it'll fit on someone's page, it depends how their printer is set up - margins and all - as well as their font presets in their browser that override yours and/or printer compatibility (or lack thereof) of the fonts you used. Also, page size will be a problem, as the standard-use page-size varies from country to country. In Europe, it's generally A4, whereas in the US it's the Letter Format (AFAIK).

Cheers,

Tom
Post Reply