<?php
 
 
    ini_set("display_errors",1);
 
    ini_set('error_reporting', 1);
 
    #ini_set("max_execution_time","false");
 
    #set_time_limit(0);
 
 
    //
 
    // +---------------------------------------------+
 
    // |     BARCODE2PRINTER :: JPEG2PS              |
 
    // +---------------------------------------------+
 
    //
 
    //
 
    //   This program is free software; you can redistribute it and/or modify
 
    //   it under the terms of the GNU General Public License as published by
 
    //   the Free Software Foundation; either version 2, or (at your option)
 
    //   any later version.
 
    //
 
    //   This program is distributed in the hope that it will be useful,
 
    //   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
    //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
    //   GNU General Public License for more details.
 
    //
 
    //   You should have received a copy of the GNU General Public License
 
    //   along with this program; if not, write to the Free Software Foundation,
 
    //   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
    //
 
    //
 
 
    /**
 
     * BARCODE2PRINTER :: JPEG2PS
 
     *
 
     * PHP code for printing barcode image or postscript file using a network printer by IP address
 
     *
 
     * @author   Emil Maran <maran.emil AT gmail DOT com>
 
     * @website  http://maran-emil.de/
 
     * @version  0.1   14 Mars 2012
 
     */
 
 
    include("barcode2printer.lib.php");
 
 
    /*
 
     * General settings
 
     */
 
 
    $sJpegsFile    = "barcode.jpg";        // Set Image Name
 
    $sPpscrFile    = "barcode.ps";            // Set Postscript Name
 
 
    $sPrinterHost = "192.168.1.2";        // Set Printer IP
 
    $sPrinterPort = "9100";                // Set Printer Port - default 9100 or 515
 
 
    $print = new PrintPS();
 
 
    $print->setHost($sPrinterHost);
 
    $print->setPort($sPrinterPort);
 
 
    $print->setPathImFile($sJpegsFile);
 
    $print->setPathPsFile($sPpscrFile);
 
    
 
    // Convert Jpeg into PS
 
    $print->convertJpeg2PS();
 
 
    // Create String from PS
 
    $sPsString = $print->fetchFile();
 
    $print->setString($sPsString);
 
    
 
    /*
 
     * Send PS String to Printer
 
     */
 
 
    if ( $print->putFile() ) {
 
        echo ( "File sent successfully" );    
 
    }
 
    else{
 
         echo ( "File not sent successfully" );    
 
    }
 
 
 
?> 
 
 |