Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

PHP create a .prn file to send to thermal printer

General discussions related to php

Moderators: macek, egami, gesf

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
{STX}="\x02";
{ETX}="\x03";
{ESC}="\x1B";


$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: ";
$L05="{ESC}%2{ESC}H0490{ESC}V1280{ESC}L0101{ESC}P03{ESC}S";
$L06="{ESC}%0{ESC}H0308{ESC}V1300{ESC}BG01050>G";
$L07="{ESC}%1{ESC}H0440{ESC}V1250{ESC}BG02050>G";
$L08="{ESC}%1{ESC}H0500{ESC}V1200{ESC}L0101{ESC}P10{ESC}M";
$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 ?
Thanks
Attachments
test_sato.zip
Output file .prn that has to be sent to Thermal printer
(492 Bytes) Downloaded 12 times
daswunder
New php-forum User
New php-forum User
 
Posts: 2
Joined: Wed Dec 26, 2012 9:16 am

Return to PHP General

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.