Link to home
Start Free TrialLog in
Avatar of simi
simi

asked on

Printing a report

I am creating a report using html.
I have a table with several columns. The first row is the title and each row presents values.
I deal with the fact that the rows are more than what the screen allows to show, by showing a number of rows, a Next and Previous button, and also numbers that allow the user to see each section of the report they wish.

I need to be able also to print the report.
I could create a "print version", of the report that is simplified, and use the print capabilities of the browser.
However the title won't show on each page, and that will make the report hard to read.
I could also create the print version in the same manner, with a title row, and 50 or how many rows can print on a page. But I don't see how can I print all pages with only one command.
Thanks.

ASKER CERTIFIED SOLUTION
Avatar of DreamMaster
DreamMaster

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dorward
dorward

As DreamMaster said, use a PDF file. With a free plugin you can use PHP (also free) to create PDFs from a database (like MySQL which is free). The basic PHP software generates HTML so you can generate online and printable versions programatically. If you don't want to use a database PHP also supports the use of XML so you can write it in that and then convert to HTML or PDF as required.
HTML is not, and never has been, a print format. As everyone else has pointed out, you are NOT going to make this print well from HTML.

Somebody will probably come along and give some option that MAY work, for a particular browser, system, printer, etc. BIG PROBLEM -- you don't KNOW what printer the user has or how it's set up. Furthermore, you CANNOT know -- because the USER can change it and doesn't need to reload the page to do so. IMHO, this gets worse, not better, in a large corporate environment, because there most people will have a CHOICE of printers -- and you don't know which one they've chosen or how it's set up. (If you've only got one type of printer, you STILL have either portrait or landscape, and you don't know that, either.)

Think of web pages as VIDEO, not PRINT. You wouldn't expect to print a movie, would you? Just because you can force an HTML document to a printer doesn't mean you've got any control over what comes out.
webwoman is spot on (as usual!).  If you are creating documents to be shared internally (e.g., within a company), then use PDF, Word, Excel, or some other package everyone has on their desktop.  HTML will NOT give you the results you want.
Avatar of simi

ASKER

Thank you to you all.