<?php 

//ini_set('display_errors',1);

require '../../libreriasphp/pdf417/vendor/autoload.php';

use BigFish\PDF417\PDF417;
use BigFish\PDF417\Renderers\ImageRenderer;
use BigFish\PDF417\Renderers\SvgRenderer;


$cadsunat = $_POST['emp_ruc'].'|'.$_POST['tipcom'].'|'.$_POST['notcre_serdoc'].'|'.$_POST['notcre_corrdoc'].'|'.$_POST['notcre_igv'].'|'.$_POST['notcre_tot'].'|'.$_POST['notcre_fec'].
'|'.$_POST['tipdoc'].'|'.$_POST['cli_numdoc'].'|'.$_POST['DigVal'].'|'.$_POST['SigVal'];
	
$filename = 'barcode/'.$_POST['notcre_serdoc'].'-'.$_POST['notcre_corrdoc'].'.png';	



$pdf417 = new PDF417();
$data = $pdf417->encode($cadsunat);

// Create a PNG image, red on green background, extra big
$renderer = new ImageRenderer([
    'format' => 'png',
    'color' => '#000000',
    'bgColor' => '#ffffff',
    'scale' => 10,
]);

$image = $renderer->render($data);
$image->save($filename);
	
?>