PHP create a .prn file to send to thermal printer

General discussions related to php

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 2
Joined: Wed Dec 26, 2012 9:16 am

PHP create a .prn file to send to thermal printer

Postby daswunder » Mon Apr 21, 2014 1:00 am

Hi all,

I did a short application that build a .prn file to send to a Thermal printer starting from a printer manual sample.

I did some variables using part of fixed text and then I added some variables coming from a SQL query.
The problem I have right now is that when I use {ESC} that is a leftward Arrow for the .prn file PHP add a blank space before and after it.

What I get now is 'blank'<--'blank'
What I need to have is only a <-- without blank before and after

This is a part of code I'm using
//Definizione stringhe per stampa bracciale

$L01="{STX}{ESC}A {ESC}EX0 {ESC}AR {ESC}A3H001V001 {ESC}CS3 {ESC}#E4 {ESC}A115000720 {ESC}Z{ETX}{STX}{ESC}A {ESC}PS {ESC}WK EOS SBPL.lbl ";
$L02="{ESC}%1{ESC}H0320{ESC}V1250{ESC}L0202{ESC}P02{ESC}SPaziente: ";
$L03="{ESC}%1{ESC}H0360{ESC}V1250{ESC}L0202{ESC}P02{ESC}SRep.:"; $L031=" Stanza:"; $L032=" Letto:";
$L04="{ESC}%1{ESC}H0400{ESC}V1250{ESC}P02{ESC}RDB00,32,32,Data nascita: ";
$L09="{ESC}/01 {ESC}~A0 {ESC}Q1 {ESC}Z{ETX} ";

Then I send all stuff to .prn file using :

$sato01 = $L01.$L02 . $pat_last_name .' '. $pat_first_name . $L03 . $pat_dept . $L031 .
$pat_room . $L032 . $pat_bed . $L04 . $pat_birth . $L05 . $pat_codfis . $L06 .
$pat_codfis . $L07 . $pat_codfis . $L08 . $pat_codfis . $L09 ;

fwrite($handle, $sato01);

The result is the attached file that has space before and after leftward Arrow.

How can eliminate them ?
Output file .prn that has to be sent to Thermal printer
(492 Bytes) Downloaded 104 times

Return to “PHP General”

Who is online

Users browsing this forum: No registered users and 5 guests