<?php
require_once __DIR__ . '/../inc/helpers.php';
require_once __DIR__ . '/../inc/pdf_render.php';
require_login();

$id=(int)($_GET['id']??0);

try{
  render_document_pdf($id);
}catch(Throwable $e){
  http_response_code(500);
  header('Content-Type: text/plain; charset=utf-8');
  echo "Error al generar PDF (factura).\n\n".$e->getMessage()."\n\n".$e->getFile().":".$e->getLine();
}
