Laman

Open Existing PDF With PHP MPDF and set Protection Password

<?php
include("MPDF57/mpdf.php");
$pdf=new mPDF();
$pdf->SetImportUse();

$pagecount = $pdf->SetSourceFile('filename.pdf');
for ($i=1; $i<=$pagecount; $i++) {
    $import_page = $pdf->ImportPage($i);
    $pdf->UseTemplate($import_page);
    if ($i < $pagecount){
        $pdf->AddPage();
    }
}

$pdf->SetProtection(array('copy','print'), '', 'password');

$pdf->Output("filename.pdf","I");
?>

Tutorial HTMLtoPDF

No comments:

Post a Comment

Silahkan