<?php
/*require("includes/check_auth_user.php");
require("includes/dbconnect.php");
include('includes/function.php');*/
ini_set('display_startup_errors',1);
ini_set('display_errors',1);
error_reporting(-1);
function browse($var)
{
    print '<script type="text/javascript">';
    print 'alert("'.$var.'")';
    print '</script>';
}


$handle = printer_open("TSC TTP-246M Plus");
$handle = printer_open();

#resource printer_open ([ string $printername ] );

////What I had been missing is that the function needed the internet host name of the server, which includes the domain name.
//  So, let's say my print server was called "PServer" and my network's domain was called php.net: 

//This will more than likely work, then you can open and print a file as follows
/*
#$printer = "\\\\Pserver.php.net\\printername"; 
$printer = "\\\\raj6-PC\\"; 
$ph = printer_open("TSC TTP-246M Plus");
//if($ph = printer_open("TSC TTP-246M Plus")) 
//{ 
    browse("GAYA");
   // Get file contents 
   $fh = fopen("MATEEN.txt", "rb"); 
   $content = fread($fh, filesize("MATEEN.txt")); 
   fclose($fh); 
        
   // Set print mode to RAW and send PDF to printer 
   printer_set_option($ph, PRINTER_MODE, "RAW"); 
   printer_write($ph, $content); 
   printer_close($ph); 
//} 
//else "Couldn't connect..."; */
browse("END");
?>