Boleto Bancário - Convert digitable line into barcode?

Asked

Viewed 5,524 times

0

It is possible to convert the digitized line of a bank note into a barcode?

I searched on this subject and found nothing that would help me to remove this doubt.

Example

I have the following line:

23793.13022 50831.414599 05006.305204 8 70010000002000

This line above displays the following barcode:

inserir a descrição da imagem aqui


Now imagine the following:

I have the following code:

<h2 id="numbers">23793.13022 50831.414599 05006.305204 8 70010000002000</h2>

Is there any way to get the numbers inside that <h2> and generate a barcode? I realize that the most used is the generation of images in formats "data:image/png;base64", as in the image above, which is equal to:

<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZUAAAAyAQAAAAC8Tnt0AAAAU0lEQVR42u3LsQ3AIAwEQEYIhZUmHseipnKTDPESiAkRtSXKDJM9or/+kqs1iG7EM4vW5blf/TXdnlHaMInZgB6zrhte5MSReHh4eHh4eHh4fn8+fNcEXfLEaAgAAAAASUVORK5CYII=">

That is, to better define the question: get the numbers inside the <h2> and generate a barcode in image format <img src="" >.

It is possible to do this in PHP? Like?

2 answers

-1

Friends, this here salvation, I had to convert a function that I found in Javascript for PHP, in Brazil has little material that helps:

$barcode = preg_replace('/(\d{4})(\d{5})\d{1}(\d{10})\d{1}(\d{10})\d{1}(\d{15})/', '$1$5$2$3$4', $linha_digitavel_sem_pontos_e_espaco);

-2

Browser other questions tagged

You are not signed in. Login or sign up in order to post.