Skip to content

Permission denied #23

@OM-Tecnologia

Description

@OM-Tecnologia

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions