Hi,

I need to implement a system, which is now written in Clipper for DOS, using Php/MySQL on a Linux server. Windows workstations will be connected to this server and use the program.

The only part of the program I cannot resolve so far is the printing.

This is a management / invoicing application. They issue 2 kinds of invoices, A or B, depending on who the client is, as per the country regulations.

They have 2 dot-matrix printers connected to the workstation the prints the invoices. One is loaded with the forms to use when printing A invoices, the other is loaded with the forms to use when printing B invoices. Currently, the Clipper program just sends the output to one printer or the other (LPT1 and LPT2). User just presses a button and invoice gets printed on the right form.

I need to make the Php app send output to the right printer in an easy way as well. Since Php runs on the server, I don't see how I can do this, but maybe there is a way to solve this issue using some client side technology to work together with Php? Any help you can provide on this matter will be really appreciated.

Thanks!

Veronica

    Hey

    One way might be to create the invoices as PDF documents, you can set the layout etc to match the stationary, although i've never tried to print one from a dot matrix printer

    http://www.devshed.com/c/a/PHP/PDF-Generation-With-PHP/

    The above link is to a tutorial on creating PDF documents that might be of use. This may give you the opportunity to create statice invoice layouts and move your clients to a laser printer but thats up to you 🙂

    Hope this helps

    Tim

      Hi timus,

      Thanks for your reply 🙂

      Yes I have generated PDF documents with Php before, I think that may be an approach, but then how do I serve the PDF directly to the right printer without having the user select the right printer for each invoice?

      They don't care about a laser printer for printing these because they get good results with the dot matrix printers and they involve very low maintenance costs. These people generate many invoices per month. And besides if they want to print the whole invoice themselves instead of using pre-printed forms, they will have to comply with some special regulations and procedures required by the country tax law. They won't like to start changing all this, they just want to get their programs re-written so they don't use Clipper anymore.

      Thanks,

      Veronica

        veronicabend wrote:

        ....dot matrix printers .... involve very low maintenance costs.

        Wow; I have a hard enough time these days just finding someone who still stocks ribbons for the things 🙂

          Everything in the unix world is a file, even printers are 'files'. So you just pipe the output stream to the lpr of choice. Have a look at the user notes here for all the code you'll need.

            Hi Veronica

            It looks like, Roger may have a point but from the way you described it, the printers aren't attached to the server so it may require some configuration.

            I know that some dos programs used to fire data straight to the com port on the computer, but i dont know how you can do this without some kind action from the user

            The following javascript will bring up a print dialog

            <form>
            <input type="button" value="Print This Page" onClick="window.print()" />
            </form>

            and i think the link belove shows a jave script function that will allow you to change wether the user is prompted before the print, but you'd need some way to set the default printer before hand...

            http://leo.evolt.org/archive/Week-of-Mon-19991213/093067.html

            I'd be interested to hear how you get on

            Regards
            Tim

              Hi Tim & Roger,

              Thanks for your replies.

              The app would run in an intranet, in a Linux server with Windows workstations. Printers would be connected to the workstation and not to the server, but maybe I can change that and have them connect the printers to the server. In that case, Roger's idea may work, if I send the output directly to the printer using lpr .

              I just followed the link in Tim's message and tried that solution as well. I reproduced the test page and it keeps prompting the print dialog even though I changed the option to OLECMDEXECOPT_DONTPROMPTUSER. This looks like a good solution if I can get it to work and also to choose to which printer the output is to be sent. It also displays a warning that potentially dangerous ActiveX is going to be executed and asks whether to go on or not. I didn't find a way in Explorer to allow this for a particular location (domain), without allowing for all.

              Regards,
              Veronica

                Write a Reply...