
            <?php
        
            require "plugins/escpos/autoload.php";
            
            use Mike42\Escpos\Printer;
            use Mike42\Escpos\EscposImage;
            use Mike42\Escpos\PrintConnectors\WindowsPrintConnector;
            use Mike42\Escpos\CapabilityProfile;
            use Mike42\Escpos\CapabilityProfiles\StarCapabilityProfile;
        
            $connector = new WindowsPrintConnector($nombreTicketera);
        
            $profile = StarCapabilityProfile::getInstance();
            $printer = new Printer($connector, $profile);
            
            /* Initialize */
            $printer->initialize();
            
            /* Font modes */
            $modes = array(
                Printer::MODE_FONT_B,
                Printer::MODE_EMPHASIZED,
                Printer::MODE_DOUBLE_HEIGHT,
                Printer::MODE_DOUBLE_WIDTH,
                Printer::MODE_UNDERLINE
            );
            
            $justification = array(
                Printer::JUSTIFY_LEFT,
                Printer::JUSTIFY_CENTER,
                Printer::JUSTIFY_RIGHT
            );
            
            $mode |= $modes[6];
            
            $printer->selectPrintMode($mode);
            $connector->write(Printer::GS . "L" . chr(0) . chr(0));
        
            $printer->setFont(Printer::FONT_B);
            $printer->setTextSize(1, 1);
            $printer->setJustification(Printer::JUSTIFY_CENTER); // centrado
            if($mostrarImagen == true){
                try {
                    //$logo = EscposImage::load("img/logo_hrl_ticket.png");
                    $logo = EscposImage::load($img_file);
                    $printer->bitImage($logo);
                } catch (Exception $e) {/*No hacemos nada si hay error*/}
            }
            $printer->text("CLINICA UNION \n");
            $printer->text("CALLE TORRES PAZ 204-230, CHICLAYO, PERU\n");
            $printer->text("RUC: 123456789     Telef: 978368886 \n\n");
            $printer->setFont(Printer::FONT_B);
            $printer->setEmphasis(false);
        
            $printer->setFont(Printer::FONT_A);
            $printer->setJustification(Printer::JUSTIFY_CENTER);
            $printer->text("HONORARIOS MEDICOS: Nº-5335\n\n");
            $printer->setJustification(Printer::JUSTIFY_LEFT);
            $printer->text("MEDICO(a): DIAZ GONZALES AUVER \n");
            $printer->text("RUC:  \n");
            $printer->text("Recibi de: QUEPUY DAMIAN ANTHONY LUIS \n");
            $printer->text("La suma de: NOVENTA CON 00/100 SOLES \n");
            $printer->text("Por Concepto de: CONSULTA UROLOGIA \n");
            $printer->text("Total neto recibido: 90.00 \n");
            $printer->text("Fecha Emision: 10/01/2025 \n\n");
        
            $printer->setJustification(Printer::JUSTIFY_LEFT);
            $printer->setFont(Printer::FONT_B);
            $printer->text("Este documento es temporal, puede solicitar su comprobante a comprobantes@clinicaunion.com.pe\n");

            $printer->text("Fecha/Hora de impresion: 10/01/2025 11:07:46 \n");
            $printer->setFont(Printer::FONT_A);
            $printer->text("---------------------------------\n");
            // $printer->text("\nDivisión de Tecnologías de la Información \n");
                
            $printer->feed(6);
            
            $printer->cut(1);
            
            $printer->pulse();
            
            $printer->close();    
        