0
votes

I have a server with ip 192.168.0.1, then I have a computer with ip 192.168.0.3 which access the server. I have a printer EPSON TM-U220 connected to 192.168.0.3, then I tried to print from the server to the printer using php command

copy($file, '//192.168.0.3/printername');

but it doesn't work, then I tried another function:

exec("print /d:\\\\192.168.0.3\\printername $file");
exec("copy $file \\\\192.168.0.3\\printername");

It says "unable to initialize device \\192.168.0.3\printername". My computer and server run on windows7.

I already shared the printer to my server, I can test print page from the server. how do I print to my network printer using PHP?

Thanks

2
it uses php_printer, and i dont have it as i use php 5.5.. i cant find php_printer.dll for php 5.5erkape

2 Answers

1
votes

After going some researches, I found a solution to my problem.

Run services.msc then double click Appache Service. At tab Log On, choose This account, then fill in the credential of the server.

After that, restart your appache..

My problem is solved after doing this..

-1
votes

Following erkape#s solution, I got auto printing for Laravel with Crystal Reports XI right:

$printname="\\\\SERVERBEKASI\\Canon iP2700 series (Copy 3)";
$driver='"winspool"';
$port='"Ne07:"';
$creport->SelectPrinter("winspool",$printname,$port);
$creport->PrintOut(fal`enter code here`se,1);

The solution on my system (Windows 7) looks like this:

  • create a new account as the administrator, set a password
  • Run services.msc, double-click Apache Service. At tab Log On, choose your new account, then fill in the credential of the server.
  • Restart Apache. Done