Ejemplo n.º 1
0
 function init()
 {
     $fileid = $this->_fileName;
     $pdf = $this;
     $pdf->SetProtection(array('print'));
     $preferences = array('HideToolbar' => true, 'HideMenubar' => true, 'HideWindowUI' => true, 'FitWindow' => true, 'CenterWindow' => true, 'DisplayDocTitle' => true, 'NonFullScreenPageMode' => 'UseNone', 'ViewArea' => 'CropBox', 'ViewClip' => 'CropBox', 'PrintArea' => 'CropBox', 'PrintClip' => 'CropBox', 'PrintScaling' => 'AppDefault', 'Duplex' => 'DuplexFlipLongEdge', 'PickTrayByPDFSize' => true, 'PrintPageRange' => array(1, 1, 2, 3), 'NumCopies' => 2);
     // set pdf viewer preferences
     $pdf->setViewerPreferences($preferences);
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor('www.thaidxc.org');
     $pdf->SetTitle('Dxc Personal Report');
     $pdf->SetSubject('ข้อมูลนักโทษ');
     $userpasss = App_Env::getUserPassword();
     $pdf->SetProtection(array('print'), $userpasss, 'sd;fkjsd;fiwupeoirj;esjf;sdjfwoeij;dsf');
     // set default header data
     $PDF_HEADER_TITLE = 'Personal Report';
     $PDF_HEADER_STRING = " by Office Of Justice Affairs ,Ministry Of Justice \nwww.thaidxc.org";
     $pdf->SetHeaderData('logo1.gif', 30, $PDF_HEADER_TITLE, $PDF_HEADER_STRING);
     // set header and footer fonts
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     // set default monospaced font
     # $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     //set margins
     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     //set auto page breaks
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     //set image scale factor
     #  $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     //set some language-dependent strings
     # $pdf->setLanguageArray($l);
     // set a barcode on the page footer
     $pdf->setBarcode(date('d m y h i s'));
     // ---------------------------------------------------------
     // set font
     // set font
     $pdf->SetFont('freeserif', '', 14);
     $pdf->AddPage();
     $name = App_Env::getUserFullName();
     $wartermark = 'ผู้พิมพ์รายงาน ' . $name . ' ' . date('d/m/Y h i s') . 'เลขที่เอกสาร ' . $fileid . '  www.thaidxc.org ';
     $pdf->StartTransform();
     $pdf->SetAlpha(0.1, 'Screen');
     $pdf->Rotate(45, 0, 200);
     for ($i = 0; $i <= 10; $i++) {
         $pdf->Text(-$i * 10, 88 + $i * 20, $wartermark . $wartermark);
         //. $wartermark . $wartermark
     }
     $pdf->StopTransform();
 }