1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
protected function headerPDF()
{
header('Content-type: application/pdf');
header('Content-Disposition: inline; filename="downloaded.pdf"');
header('Content-Transfer-Encoding: binary');
header('Accept-Ranges: bytes');
}
public function pdfAction($fichier, $polNum)
{
$this->view->disable();
$config = $this->getDi()->get('config');
$lien = $config->application->fichiersDir . "DispoGene/" . $fichier . '.pdf';
if (file_exists($lien)) //cette partie pose problème
{
$this->headerPDF();
header('Content-Length: ' . filesize($lien));
$content = file_get_contents($lien);
//DebugBreak("1@10.50.1.27;d=1,p=0");
//readfile($lien);
echo $content;
}
else
{
$pdf = new \Models\Societaire\PDF();
$pdf->getPDF($polNum, $fichier);
$result = $pdf->toArray();
if ($result->codeInfo == '0')
{
$this->headerPDF();
echo $result->opmp_doc;
}
else
{
echo "<script>window.close();</script>";
}
}
} |
Partager