On Tue, Oct 14, 2008 at 6:25 PM, Ashley Sheridan<ash@xxxxxxxxxxxxxxxxxxxx> wrote:> On Tue, 2008-10-14 at 19:15 -0300, Miles Thompson wrote:>> On Tue, Oct 14, 2008 at 6:23 PM, Dušan Novaković <ndusan@xxxxxxxxx> wrote:>>>> > I have some request to sent text to matrix printer to print ticket for>> > theater. Is it possible to do that whit some php functions? Main point>> > is how to control length of paper that will be drawn inside and to>> > print text on a specific place. It would be nice if somebody can write>> > the code about this as example.>> >>> > Thnx, Dusan>> >>> > -->> > made by Dusan>> >>>>> Decide on the font you will use - either 10 or 12 characters per inch.>> A line is usually 1/8" high.>>>> So you essentially have a matrix running at "n" characters per inch>> horizontally, and "m" fractions of an inch vertically.>>>> Fit your print into this matrix - some people do it with an array, others>> just work the spaces.>>>> Provide a "test" ticket so the operator can get the printer lined up. With>> a tractor feed, after that you are good for a whole box of tickets.>>>> Oh - one more thing - you may have to advance a number of lines so the>> ticket can be torn off after printing, then reverse feed the same number.>>>> Another tip - set your page length just to the height of the ticket.>>>> You really want to exploit the basic native font built into the printer.>>>> Hope this helps - Miles>> I'm not sure I would have chosen PHP as the ideal language for this kind> of thing, as it's strengths are mainly in the web server field. I> suppose it could be done with the PHP CLI. Have you found a spec for the> printer, i.e. what inputs it accepts, or is there a driver API that you> know it uses?>>> Ash> www.ashleysheridan.co.uk I don't know the OP's requirements, but I have seen more than oneproject where a web-based app needed to print (to a machine connectedto the server, not on the client, obviously.) One was a nifty app forthe doctors in an office that let them write drug prescriptions on aPDA connected to the office Wi-Fi. The prescription became part of thepatient's electronic medical record and was also sent to one of acouple special printers located around the office. I think in thiscase the print job was picked up by another program/process ratherthan being called directly from the web server. I know PHP has a Windows-only extension for working with printers.(I've never tried it, though.) I'm not sure how you'd do the same for*nix. Since it's a dot-matrix, is it possible for PHP open a stream tothe printer and write the correct control codes directly just asthough it were a file? Andrew