Printing from an HTML Page

Hi All,

I am developing an application that will run on the Internet for a client. At some point I will have a need to print hard copy Routing slips to be given to field personnel so they can perform the service at the client site.

I realize that printing from the web is not natural so I have a problem - How do I create these hard Copy Routing slips. Will it be necessary to build a desktop application to retrieve the needed data from the MySQL database and print them locally or is there some slick way to print these things directly through the web HTML itself? There could be as many as 100 or 200 per day.

If it is necessary to build a desktop app what would you recommend to be the best product for building such a print routine.

Thanks for the advise.

Rick

I definitely wouldn’t say a desktop app is necessary. Not sure how well it would work to do some kind of layout with a CSS print stylesheet, but it’s a fairly simple possibility to look into.

What I’d personally go with in a situation like this one is to generate a PDF using server-side scripting such as in Ruby, Python or PHP. There are libraries for those languages that you can use to generate a PDF print-out fairly easy. I’m thinking this is much more reliable than any CSS solution.

As an example, Magento Commerce is an ecommerce platform written in PHP that generates PDF packing slips for print-out (and/or download).

Thanks Daniel for the reply,

Your response is actually good news for me, because I really did not want to have to go to the Desktop app route. I want to explore further the possibility of generating a PDF file that can be printed. That is a great solution if I can figure out how to do it.

I am using MySQL as the Database and PHP as the development language. Not sure where to find info on generating PDF from PHP - Any Ideas here?

Rick

Did some quick Googling for you and it seems PHP has a whole bunch of libraries for this. Lots of information available in this thread on Stack Overflow:

http://stackoverflow.com/questions/560583/which-is-the-best-pdf-library-for-php

I also found an article here on SitePoint. It’s from 2003 but hey, it might still be useful:

Generate PDFs with PHP Article » SitePoint

You’ll find some libraries on the first page of a Google search, only question is which one suits you best. I suggest you take a look at them and see if you find one that you like! :slight_smile:

php pdf library - Google Search

Maybe there’s some user here on SitePoint that has experience with one or several of these libraries and can share some thoughts and opinions, that would be nice. Good luck and please let me/us know how it goes!

Thanks Danial,

Thats what I have been doing. (Goggling) I first started reading the SitePoint Article and it references PDFlib. I do not have that on my servers so I inquired about it and I would have to get an expensive commercial license to install it. Not a good solution. I’ll look into some of these other options and see what is available.

Thanks again for your advise.

Rick

I’ve been using FPDF, works pretty well, you don’t have to actually install anything on the server, just include the libs, etc.

FPDF