Hi

Just wondering whether anyone can help with this. I want to know whether it is possible to print using PHP. I would like to have a button/link that says print that when clicked would print the contents of a database table without the actual contents appearing on the web page. Is that possible?

I would also like to be able to customise the output for example use tables/borders/vertical text etc.

Thanks

    Not really. It would be a bit of a security risk (people would prefer to see what they're getting before spending paper on it).

      Let's get something straight - do you want to print on the client or the server?

      Your best bet is to make a HTML page with a suitable print css, then show it in a window and get the user to print that. Javascript has a method on the window object - window.print() which will cause the user's print dialogue box to pop up - but it won't print unless the user subsequently confirms it.

      If you need to print many different things at once, it might be better to add them to some kind of server-side print queue (per user), then have a button which generates one large HTML page (again, with suitable print css) ciontaining all the reports you want, so the user can print them all in one batch rather than having to confirm each one.

      Mark

        Write a Reply...