PHP : How to password protect pdf in PHP By TCPDF
insert the code after the TCPDF object is created:
- $pdf->SetProtection($permissions=array('print', 'copy'), $user_pass='PASSWORD', $owner_pass=null, $mode=0, $pubkeys=null);
Example :
- /* create new PDF document*/
- $pdf = new TCPDF('P', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
- $pdf->SetProtection($permissions=array('print', 'copy'), $user_pass='123456', $owner_pass=null, $mode=0, $pubkeys=null);
Open on web browser.
Save file and open on program pdf.
****** Function On TCPDF *********
- public function SetProtection($permissions=array('print', 'modify', 'copy', 'annot-forms', 'fill-forms', 'extract', 'assemble', 'print-high'), $user_pass='', $owner_pass=null, $mode=0, $pubkeys=null)
- {
- }
ไม่มีความคิดเห็น:
แสดงความคิดเห็น