PHP Classes

File: Sample

Recommend this page to a friend!
  Classes of li dongliang   Barcode Print   Sample   Download  
File: Sample
Role: Example script
Content type: text/plain
Description: sample file
Class: Barcode Print
Print barcode graphics using GNU barcode
Author: By
Last change: usage of class sample
Date: 18 years ago
Size: 2,110 bytes
 

Contents

Class file image Download
<html>
<body>
<form>
<?php
   
include_once ('MyBarcode.php');

   
$s="<table><tr><td>Printer:<td>";
   
$s.="<select name='Printers'>";
    foreach (
printer_list(PRINTER_ENUM_LOCAL | PRINTER_ENUM_SHARED) as $printer)
    {
       
$curprin = strtoupper($printer["NAME"]);
       
$s.= "<option value=\"" . addslashes($curprin) . "\"" . ">$curprin\n";
    }
   
$s.="</select>";
   
$s.="<tr><td>Encoding:<td>";
   
$s.="<select name='Encoding'>";
       
$s.="<option value='ANY'>ANY";
       
$s.="<option value='EAN'>EAN";
       
$s.="<option value='UPC'>UPC";
       
$s.="<option value='ISBN'>ISBN";
       
$s.="<option value='39'>39";
       
$s.="<option value='128'>128";
       
$s.="<option value='128B'>128B";
       
$s.="<option value='128C'>128C";
       
$s.="<option value='I25'>I25";
       
$s.="<option value='128RAW'>128RAW";
       
$s.="<option value='CBR'>CBR";
   
$s.="</select>";
   
$s.="<tr><td>Scale:<td><input type='text' name='Scale' value='8'>";
   
$s.="<tr><td>Show Text:<td><select name='ShowText'><option value='true'>true<option value='false'>false</select>";
   
$s.="<tr><td>Height:<td><input type='text' name='Height' value='70'>";
   
$s.="<tr><td>Position X:<td><input type='text' name='PosX' value='500'>";
   
$s.="<tr><td>Position Y:<td><input type='text' name='PosY' value='500'>";
   
$s.="<tr><td>Barcode:<td><input type='text' name='Barcode' value='7654321'>";
   
$s.="</table>";
    echo(
$s);

    echo(
"<input type='submit' name='Print' value='Print'>");
   
    if(isset(
$_REQUEST['Barcode']))
    {
       
$Printer = printer_open($_REQUEST['Printers']);
       
$Barcode=$_REQUEST['Barcode'];
       
$ShowText=$_REQUEST['ShowText'];
       
$Encoding=$_REQUEST['Encoding'];
       
$Scale=$_REQUEST['Scale'];
       
$Height=$_REQUEST['Height'];
       
$PosX=$_REQUEST['PosX'];
       
$PosY=$_REQUEST['PosY'];
       
$Space=0;
       
       
printer_start_doc($Printer, "Ticket Print");
       
printer_start_page($Printer);

       
$bc=new MyBarcode;
       
$bc->barcode_print($Printer,$Barcode, $ShowText,$Encoding, $Scale ,$Height,$PosX,$PosY,$Space);

       
printer_end_page($Printer);
       
printer_end_doc($Printer);
       
printer_close($Printer);
    }
?>
</form>
</body>
</html>