can't set length/width of paper when printing

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Niappi
Forum Newbie
Posts: 3
Joined: Thu Mar 18, 2004 9:55 am

can't set length/width of paper when printing

Post 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
TheBentinel.com
Forum Contributor
Posts: 282
Joined: Wed Mar 10, 2004 1:52 pm
Location: Columbus, Ohio

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

Post 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.
Niappi
Forum Newbie
Posts: 3
Joined: Thu Mar 18, 2004 9:55 am

Post 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);
Niappi
Forum Newbie
Posts: 3
Joined: Thu Mar 18, 2004 9:55 am

Post by Niappi »

actually the command is

Code: Select all

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