imagefilledrectangle($im, $xpos, 0, $xpos + $elementwidth - 1, $barcodeheight, $black);
            $xpos += $elementwidth;
            // deixa o espaco correspondente ao bit do caractere par (branco)
            $elementwidth = substr($codingmap[$charpar], $baridx, 1) ? $barcodethickwidth : $barcodethinwidth;
            $xpos += $elementwidth;
            //        $xpos ++;
        }
    }
    // imprime o codigo de final
    $elementwidth = $barcodethickwidth;
    imagefilledrectangle($im, $xpos, 0, $xpos + $elementwidth - 1, $barcodeheight, $black);
    $xpos += $elementwidth;
    $xpos += $barcodethinwidth;
    //$xpos++;
    $elementwidth = $barcodethinwidth;
    //imagefilledrectangle($im, $xpos, 0, $xpos + $elementwidth - 1, $barcodeheight, $black);
    imagefilledrectangle($im, $xpos, 0, $xpos + $elementwidth - 1, $barcodeheight, $black);
    //imagefilledrectangle($im, 0, 0,imagesx($im),imagesy($im), $black);
    //////imagecopyresized($saida,$im,$xp,$yp,0,0,imagesx($im),imagesy($im),imagesx($im),imagesy($im));
    //imagecopyresampled()
    //imagecopyresized(
    // retorna a imagem
    //Header(  "Content-type:  image/gif");
    Header("Content-type:  imagejpeg");
    imagejpeg($im);
    ImageDestroy($im);
    return;
}
parse_str($HTTP_SERVER_VARS['QUERY_STRING']);
int25(5, 5, $text);
ImageString($img, 3, 12, 819, $k00_hist6, $preto);
ImageString($img, 3, 12, 832, $k00_hist7, $preto);
ImageString($img, 3, 12, 845, $k00_hist8, $preto);
// nome do contribuinte
ImageString($img, 2, 12, 871, "Nome:      " . $identificacao[0], $preto);
ImageString($img, 2, 12, 884, "Endereço:  " . $identificacao[1], $preto);
ImageString($img, 2, 12, 897, "Município: " . $identificacao[2] . " - " . $identificacao[3] . "  " . "CEP:       " . substr($identificacao[4], 0, 2) . "." . substr($identificacao[4], 2, 3) . "-" . substr($identificacao[4], 3, 2), $preto);
//numpre
//ImageString($img,3,340,645,$numpre,$preto);
//valor
//ImageString($img,3,540,645,$valor,$preto);
//codigo de barras
//ImageString($img,3,150,680,$codigo_barras[1],$preto);
//int25($img,125,700,$codigo_barras[0]);
ImageString($img, 3, 150, 855, $codigo_barras[1], $preto);
int25($img, 10, 927, $codigo_barras[0]);
//int25($img,70,700,"81704000001294003502003012400003305179800996");
//Receitas
ImageString($img, 2, 70, 265, "Taxa Bancária", $preto);
ImageString($img, 2, 577, 265, $taxabancaria, $preto);
//k02_receit k02_descr k02_drecei valor
$c = 0;
for ($i = 0; $i < sizeof($dados); $i++) {
    $aux = split("&&", $dados[$i]);
    ImageString($img, 2, 35, 280 + $c, $aux[0], $preto);
    ImageString($img, 2, 70, 280 + $c, $aux[2], $preto);
    ImageString($img, 2, 380, 280 + $c, $aux[1], $preto);
    $aux = number_format($aux[3], 2, ".", ",");
    $x = strlen($aux);
    for ($j = 600; $x--; $j -= 5) {
        ImageString($img, 2, $j, 280 + $c, $aux[$x], $preto);
//Data do Documento
ImageString($img, 3, 12, 109, $dt_hoje, $preto);
//Numero do Dopcumento
ImageString($img, 3, 125, 109, $numero, $preto);
//Especie de Aceite
ImageString($img, 3, 247, 109, $k15_espec, $preto);
//Aceite
ImageString($img, 3, 340, 109, $k15_aceite, $preto);
//Data processamento
ImageString($img, 3, 410, 109, $dt_hoje, $preto);
//Data processamento
ImageString($img, 3, 530, 109, $fc_numbco, $preto);
//Codigo do cedente
ImageString($img, 3, 12, 134, '', $preto);
//carteira
ImageString($img, 3, 120, 134, $k15_carte, $preto);
//Valor
ImageString($img, 3, 540, 134, $valor, $preto);
//Linha 1
ImageString($img, 3, 12, 157, $k00_hist1, $preto);
ImageString($img, 3, 12, 170, $k00_hist2, $preto);
ImageString($img, 3, 12, 183, $k00_hist3, $preto);
ImageString($img, 3, 12, 196, $k00_hist4, $preto);
ImageString($img, 3, 12, 212, $k00_hist5, $preto);
ImageString($img, 3, 12, 222, $k00_hist6, $preto);
ImageString($img, 3, 12, 235, $k00_hist7, $preto);
ImageString($img, 3, 12, 248, $k00_hist8, $preto);
ImageString($img, 3, 150, 358, $codigo_barras[1], $preto);
int25($img, 10, 332, $codigo_barras[0]);
ImagePNG($img);
imagedestroy($img);