Page 1 of 1

can't set length/width of paper when printing

Posted: Thu Mar 18, 2004 9:55 am
by Niappi
Task
i have a couple of php scripts that need to print documents each with different paper formats.

Problem
I try setting the width and length manually with the following printer_set_option commands:

Code: Select all

<?php
printer_set_option($handle,PRINTER_PAPER_FORMAT,PRINTER_FORMAT_CUSTOM);
printer_set_option($handle,PRINTER_PAPER_LENGTH,175);
printer_set_option($handle,PRINTER_PAPER_WIDTH,275);
?>
The changes seem to be applied when i verify with printer_get_option but when I print, the default settings are used...Anyone know how to correctly set the options?

Constraints
1- The formats are not standard
2- Tractor fed
3- They need to print on the same printer
4- Printer is old and discontinued -> Fujistu DL 3400
5- XP or Win 2000

Re: can't set length/width of paper when printing

Posted: Thu Mar 18, 2004 11:30 am
by TheBentinel.com
The old dot matrix printers I used to screw around with required specific codes be sent to them, usually preceeded by an escape character (chr(27), I believe)

Do you have a book of those codes? Maybe the printer_set_option function is saying what it thinks is the right thing to say, but it's being ignored by the printer.

If I'm right (don't bet on it) you'll need to print those codes just like text.

Posted: Thu Mar 18, 2004 4:47 pm
by Niappi
thx for the reply.

tried to send commands to the printer but all I get is

Warning: couldn't allocate the printerjob [1804]

when I try with

Code: Select all

printer_write($handle,chr(27) . chr(67) . chr(0) . "7";,0,0);

Posted: Thu Mar 18, 2004 4:48 pm
by Niappi
actually the command is

Code: Select all

printer_write($handle,chr(27) . chr(67) . chr(0) . "7");