You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't know what else i need to do, i already gave the permission (but i think it's not even needed)
failed to open stream: Permission denied in line /Includes/fpdi/fpdf.php on line 1046 FPDF error: Unable to create output file: book_protected.pdf
fpdf.php line 1046: $f=fopen($name,'wb');
My code:
function pdfEncrypt ($origFile, $password, $destFile){
$pdf =& new FPDI_Protection();
// set the format of the destinaton file, in our case 6×9 inch
$pdf->FPDF('P', 'in', array('6','9'));
//calculate the number of pages from the original document
$pagecount = $pdf->setSourceFile($origFile);
// copy all pages from the old unprotected pdf in the new one
for ($loop = 1; $loop <= $pagecount; $loop++) {
$tplidx = $pdf->importPage($loop);
$pdf->addPage();
$pdf->useTemplate($tplidx);
}
// protect the new pdf file, and allow no printing, copy etc and leave only reading allowed
$pdf->SetProtection(array(),$password);
$pdf->Output($destFile, 'F');
return $destFile;
}
Did i miss something?
The text was updated successfully, but these errors were encountered:
As you can see the error is raised because PHP has no permissions to open a file handle at the path given in $destFile. It is simply up to you to pass a path with the correct permissions. So this is not an issue in FPDF or FPDI but you can also trigger that problem in your own scope by simply calling:
Mhh ok strange. @JanSlabon's line from above may not trigger an error immediately but if the result $fh is FALSE it also failed. Have you checked against the result?
I don't know what else i need to do, i already gave the permission (but i think it's not even needed)
failed to open stream: Permission denied in line /Includes/fpdi/fpdf.php on line 1046 FPDF error: Unable to create output file: book_protected.pdf
fpdf.php line 1046: $f=fopen($name,'wb');
My code:
Did i miss something?
The text was updated successfully, but these errors were encountered: