I am using zend library to render bar code and it works as I'm getting bar code using:
<img src="<?php echo '/controller/print/'.$id.'/'.$barcode; ?>">
Where bar code settings are:
public static function generate_barcode($id, $factor = 1, $backgroundColor = '#FFFFFF', $barHeight = 50, $fontSize = 10)
{
$code = self::create_barcode_code($id);
$barcodeOptions = array('text' => $code, 'factor' => $factor, 'backgroundColor' => $backgroundColor, 'barHeight' => $barHeight, 'fontSize' => $fontSize);
$rendererOptions = array('imageType' => 'gif');
$image = Zend\Barcode\Barcode::factory('ean13', 'image', $barcodeOptions, $rendererOptions)->render();
return $image;
}
private static function create_barcode_code($id)
{
$code = str_pad($id, 10, '0', STR_PAD_LEFT);
return $code;
}
Issue is that in header I'm getting this weird chars and don't know how to get rid of it.
GIF87as>����,s>���j���qk�vc��=��ye�!�f�Z��\hv��:�ʰ���,����''�Т��Jji�n�C C}������m�=��E�N��m��V$82%g�����Lj�g�Sy������9�C�RfyY�������$%jhZ:��ȩ X�)XGZzk[��+�K�wL|��ٛL�5k�����F]){�L>�l*]%>[��ޤ���}wl��=?M ��}���D\�v�| ���t�M[D�{V��Fa���xB �x#�m��K��<,IB4���{Bb���1�)-� ���t:e��4�R� Q���aKhT�� ���֤.�z#zu�џR�����L45�r};Ԫ2|b�F=�1�ׅa��h)�z�����$^uNCe[0�ozy^�s?�g;��կh�' �����̣�|]���ճk�e\-��~;��o#w�<2qy�9�N�װ��ƫ^ߋ�/���mw���3��ݽ>��7�����?}�d����_Y?�o���|�I�_k�ٗ�l�%�58܃�aSrAw�|��Z�}� �n)�߆���Hb�PQB �h���<��Ӎ8��cx,� e���+Ij�P����O.9E��Pً��H1��F�QQ[���/j�tf�F�S�h�H�Wv�9'�w�)Ì:�L�\z�%�
��o y�J�&j�Y6�����i�� d�Dz:d� ���;�(�0��j��� k���P;