<?php
$idDocumento = $_POST["idDocumento"];
$nomeDocumento = "bs" . " " . $_POST["nomeDocumento"] . " " . $_POST["tipoLayout"];
$tipoLayout = $_POST["tipoLayout"];

$command = 'jasperstarter process C:\wamp64\www\buesimplesweb\gestao\layout/'. $tipoLayout .'.jrxml -H localhost -u root -t mysql -n test1234 --db-url "jdbc:mysql://localhost:3306/test1234" --jdbc-dir "C:\Program Files (x86)\JasperStarter\jdbc" -P parametro="' . $idDocumento . '" -f pdf -o C:\wamp64\www\buesimplesweb\gestao\documento/' . strtoupper(str_replace(" ", "_", str_replace("/", "_", $nomeDocumento)));
exec($command);
echo json_encode(strtoupper(str_replace(" ", "_", str_replace("/", "_", $nomeDocumento))));
