$error = true;
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php";
include_once($configPath);
if (isset($_SESSION["utente"]) && !empty($_POST["content"]) && tokenVerify()) {
$content = $_POST["content"];
if (!empty($content)) {
$error = false;
ob_start();
?>
= __("Export") ?>
$html = ob_get_clean() . $content . "";
$pdf = documentConverter::getPDFWithWKHTML($html,$_POST["size"] ?? "A4",$_POST["format"] ?? "portrait");
if (!empty($pdf)) {
$error = false;
header("Content-type: application/pdf");
header("Cache-Control: no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0");
header("Content-Disposition: inline; filename=export.pdf");
echo $pdf;
}
}
}
if ($error) {
header('HTTP/1.0 403 Forbidden');
die();
}