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
doggy
Forum Commoner
Posts: 80 Joined: Tue Dec 09, 2003 5:01 am
Location: South Africa
Post
by doggy » Tue Jan 27, 2004 3:47 am
i found this at
http://www.php.net
Code: Select all
<?php
$handle = printer_open();
printer_write($handle, "Text to print");
printer_close($handle);
?>
but it gives me this error
Fatal error: Call to undefined function: printer_open() in C:\FoxServ\www\base.php on line 2
all i want to do is print files using php . any one know how
JayBird
Admin
Posts: 4524 Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:
Post
by JayBird » Tue Jan 27, 2004 3:51 am
are you running on a windows machine?
The printer functions are windows ONLY.
Mark
doggy
Forum Commoner
Posts: 80 Joined: Tue Dec 09, 2003 5:01 am
Location: South Africa
Post
by doggy » Tue Jan 27, 2004 3:59 am
yes it is a windows
doggy
Forum Commoner
Posts: 80 Joined: Tue Dec 09, 2003 5:01 am
Location: South Africa
Post
by doggy » Tue Jan 27, 2004 4:08 am
i still don`t anderstand why its not working
twigletmac
Her Royal Site Adminness
Posts: 5371 Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK
Post
by twigletmac » Tue Jan 27, 2004 4:33 am
Have you enabled the extension mentioned in the user comments on the page I linked above?
Mac
doggy
Forum Commoner
Posts: 80 Joined: Tue Dec 09, 2003 5:01 am
Location: South Africa
Post
by doggy » Tue Jan 27, 2004 4:40 am
yes i have
---
[Printer]
;printer.default_printer = ""
;extension=php_printer.dll
JayBird
Admin
Posts: 4524 Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:
Post
by JayBird » Tue Jan 27, 2004 4:58 am
have you
Added the line extension=php_printer.dll to your php.ini file.
If it is already there does it have a ; infront of it? If so then remove the ;
Have you restarted the webserver after removing the ;?
Does the php_printer.dll file exist in your extensions folder?
Is the extensions folder path in your PHP ini file correct?
When you run phpInfo() does it show a section for the printer extension?
Mark
doggy
Forum Commoner
Posts: 80 Joined: Tue Dec 09, 2003 5:01 am
Location: South Africa
Post
by doggy » Tue Jan 27, 2004 5:05 am
printer
Printer Support enabled
Default printing device
Module state working
RCS Version $Id: printer.c,v 1.23 2002/05/17 18:49:42 fmk Exp $
ol4pr0
Forum Regular
Posts: 926 Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador
Post
by ol4pr0 » Tue Jan 27, 2004 10:41 am
Code: Select all
$handle = printer_open("Canon BJC-85");
// shouldnt the printer be specified either by name or network?
doggy
Forum Commoner
Posts: 80 Joined: Tue Dec 09, 2003 5:01 am
Location: South Africa
Post
by doggy » Tue Jan 27, 2004 11:55 pm
yeah i did all that but it is still not printing.
Code: Select all
<?php
$handle = printer_open("Xerox 3006");
printer_start_doc($handle, "My Document");
printer_start_page($handle);
$font = printer_create_font("Arial", 72, 48, 400, false, false, false, 0);
printer_select_font($handle, $font);
printer_draw_text($handle, "test", 10, 10);
printer_delete_font($font);
printer_end_page($handle);
printer_end_doc($handle);
printer_close($handle);
?>
the page just loads for ever