<?php
  require "UserAdmin/super_secret_stuff.php";
  $id = $_GET["id"];
  $output_file = $proj_file_path . "/job_{$id}/calibro_report.pdf" ;
  if(!file_exists($output_file))$output_file = $proj_file_path . "/job_{$id}/report.pdf";
  $tmpfile = "calibro_report_" . $id . ".pdf";
  copy($output_file,$tmpfile);
  ob_clean(); // clean output buffer
  header('Content-Type: application/octet-stream');
  header('Content-Length: ' . filesize($tmpfile));
  header('Content-Disposition: attachment; filename=' . basename($tmpfile));
  readfile($tmpfile);
?>