Jump to content
Sign in to follow this  
Cacio Renato

codigo de barras em hexadecimal

Recommended Posts


Opa galera , estou tentando gerar um hexadecimal para mandar um comando direto pra porta da impressora e ela me gerar um codigo de barras estou com dificuldade em gerar comecei a fazer o comando para mandar, estava me baseando no comando do delphi e estou implementando no php mas esta me gerando uns comando diferente a impressora que estou testando a impressão direta é a MPT III.


$chave = "43160308421998000100550010000000051000000050";

$lch = "";

$dec = "";

$dec .= chr((int)(dechex(20)));

$dec .= chr((int)(dechex(20)));

$dec .= chr((int)(dechex('1d')));

$dec .= chr((int)(dechex(68)));

$dec .= chr((int)(dechex(40)));

$dec .= chr((int)(dechex('1d')));

$dec .= chr((int)(dechex(77)));

$dec .= chr((int)(dechex(02)));

$dec .= chr((int)(dechex('1d')));

$dec .= chr((int)(dechex(48)));

$dec .= chr((int)(dechex(02)));

$dec .= chr((int)(dechex('1d')));

$dec .= chr((int)(dechex('6b')));

$dec .= chr((int)(dechex(18)));

$dec .= chr((int)(dechex('7d')));

$dec .= chr((int)(dechex(43)));


$chaveasc = "";

for($i = 0; $i < strlen($chave); $i++){


$lch .= $chave{$i};


if((($i+1) % 2 == 0) && ($i > 0)){

//echo $lch.'<br/>';

$dec .= chr((int)(dechex($lch)));


$lch = "";

//echo $dec.'<br/>';

}

}

$dec .= chr((int)(dechex(20)));


//echo $dec;

$fp = fopen("bloco1.txt", "a");

$escreve = fwrite($fp,$dec);

fclose($fp);

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

Ao usar o fórum, você concorda com nossos Terms of Use.