I want to secure the display of my PDF : firstly hide the PDF's source link for the user, and secondly make PDF download impossible.
I was on the first point, I used :
<?php
$file = "./src/file.pdf";
header("Content-type: application/pdf");
header("Content-Length: " . filesize($file));
readfile($file);
?>
That work very well on a page without any HTML, but if I only add :
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>TEST</title>
</head>
<body>
<div>
<!-- Some elements -->
</div>
<div>
<?php
$file = "./src/file.pdf";
header("Content-type: application/pdf");
header("Content-Length: " . filesize($file));
readfile($file);
?>
</div>
</body>
</html>
That dosn't work at all
So how can I do ? Because I want the PDF at this place, surrounded by HTML.
If someone have the solution, or more than that, the solution for hidding PDF's source link and secondly make PDF download impossible.
I thank you very much for your time and your patience !