Link to home
Start Free TrialLog in
Avatar of MrTV
MrTVFlag for Thailand

asked on

every time i close the bill I want it automatic print,

I write program with php, how  can it print invoice when customer make a payment , pres  bottom then it print with out any confirm and select printer, what is printer that work good i use windows 10,
SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of MrTV

ASKER

Hi  An Average Forum Participant Just For Fun


( ! ) Parse error: syntax error, unexpected '[' in C:\wamp\www\test\print.php on line 10
Hi!

Okay so in line 10, you might want to change the 'Name' to the actual name of the printer you want to auto-print.

For example:

$handle = printer_open(getprt['HP LaserJet 4350']);

Open in new window

Avatar of MrTV

ASKER

it still show ( ! ) Parse error: syntax error, unexpected '[' in C:\wamp\www\test\print.php on line 10


<?php

ini_set('display_errors',1);
error_reporting(E_ALL);
	
$contents="Test print.";
eval("\$output = \"$contents\";");

$getprt=printer_list( PRINTER_ENUM_LOCAL | PRINTER_ENUM_SHARED );
$handle = printer_open(getprt['Canon MP230 series Printer']);
     if($handle)
          echo "connected";
     else
          echo "not connected";    
printer_set_option($handle, PRINTER_MODE, "raw"); 
printer_write($handle,$output);
printer_close($handle);
			
?>

Open in new window

Okay before I tell you what I think is the problem, allow me to explain something.. A class of printers, often called network printers, are specifically designed for connecting directly to a computer network.  Is your station configured to adapt specifically or operate differently when connected to a certain network?? (e.g. at work, at school, at a government building)
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of MrTV

ASKER

IF I use JavaScript or another  language such as c#  it is possible to print with out confirm or not      incase I use c# How can i use php or javacript to triggered c# program
Where do you want the print out to be printed?

On the client workstation
OR
The server
Avatar of MrTV

ASKER

I prefer print in client
Then as discussed - that is not possible.

C# won't help you nor will any other server-side language - because they run on the server they don't have any control of the client at all.

If you want to interact with the client then you use JavaScript - JavaScript will allow you to initiate a print of the page with window.print() but you cannot start the print job, nor can you select anything regarding the print job. Only the user can make the final printer selection and initiate the print.