Merge pull request #8764 from hregis/develop_email

NEW add pdf function to check if pdf file is protected/encrypted
This commit is contained in:
Laurent Destailleur 2018-05-10 12:08:58 +02:00 committed by GitHub
commit fddd628f08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -169,6 +169,25 @@ function pdf_getInstance($format='',$metric='mm',$pagetype='P')
return $pdf;
}
/**
* Return if pdf file is protected/encrypted
*
* @param TCPDF $pdf PDF initialized object
* @param string $pathoffile Path of file
* @return boolean True or false
*/
function pdf_getEncryption(&$pdf, $pathoffile)
{
$isencrypted = false;
$pdfparser = $pdf->_getPdfParser($pathoffile);
$data = $pdfparser->getParsedData();
if (isset($data[0]['trailer'][1]['/Encrypt'])) {
$isencrypted = true;
}
return $isencrypted;
}
/**
* Return font name to use for PDF generation