On Tue, Oct 14, 2008 at 6:25 PM, Ashley Sheridan
<[EMAIL PROTECTED]> 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ć <[EMAIL PROTECTED]> 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 one
project where a web-based app needed to print (to a machine connected
to the server, not on the client, obviously.) One was a nifty app for
the doctors in an office that let them write drug prescriptions on a
PDA connected to the office Wi-Fi. The prescription became part of the
patient's electronic medical record and was also sent to one of a
couple special printers located around the office. I think in this
case the print job was picked up by another program/process rather
than 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 to
the printer and write the correct control codes directly just as
though it were a file?

Andrew

Reply via email to