I have been struggling with this for a while. On my intranet site I create PDF's, and assign them a password (they all have the same password). Now i want to know if there's a method to send the pdf document the password via php? I assume it would be done here:
Code: Select all
$file = "../../../base/ScanReport.pdf";
if (file_exists($file))
{
header('Content-Description: File Transfer');
header('Content-Type: MIME');
header('Content-Disposition: inline; filename='.basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
exit;
}
else
{
echo "<font color = 'red'>Something went wrong, file not created.</font>";
}