WKHtmlToPDF::setDocuments PHP Method

setDocuments() public method

public setDocuments ( $count )
    public function setDocuments($count)
    {
        $this->documents = $count;
    }

Usage Example

 /**
  * create the PDF file as a ProtectedFile for the given side.
  *
  * @param CController $controller
  * @param array       $template_data
  * @param string      $side
  *
  * @throws Exception
  *
  * @return ProtectedFile|null
  */
 protected function createAndSavePdfForSide(CController $controller, array $template_data, $side)
 {
     if ($html = $this->getPDFContentForSide($controller, $template_data, $side)) {
         $html = '<link rel="stylesheet" type="text/css" href="' . $controller->assetPath . '/css/print.css" />' . "\n" . $html;
         $this->event->lock();
         if (!$this->event->hasPDF('therapy_application')) {
             $wk = new WKHtmlToPDF();
             $wk->setDocuments(1);
             $wk->setDocRef($this->event->docref);
             $wk->setPatient($this->event->episode->patient);
             $wk->setBarcode($this->event->barcodeHTML);
             $wk->generatePDF($this->event->imageDirectory, 'event', 'therapy_application', $html, false, false);
         }
         $this->event->unlock();
         if (@$_GET['html']) {
             return Yii::app()->end();
         }
         $pfile = ProtectedFile::createForWriting('ECForm - ' . $side . ' - ' . $template_data['patient']->hos_num . '.pdf');
         if (!@copy($this->event->getPDF('therapy_application'), $pfile->getPath())) {
             throw new Exception('Unable to write to file: ' . $pfile->getPath());
         }
         if (!$pfile->save()) {
             throw new Exception('Unable to save file: ' . print_r($pfile->errors, true));
         }
         return $pfile;
     }
     return;
 }
All Usage Examples Of WKHtmlToPDF::setDocuments