src/Pdf.php
public function openPdf($pdfTemplate)
	{
		$this->debug->groupCollapsed(__CLASS__.'->'.__FUNCTION__);
		$p = $this->p;
		$pdiOpts = 'errorpolicy=return';
		if (is_object($pdfTemplate) || preg_match('/[\\x00-\\x1f]/', $pdfTemplate)) {
			if (is_object($pdfTemplate)) {
				$this->debug->log('pdfTemplate is object');
				$p->create_pvf($this->pvf, $pdfTemplate->get_buffer(), '');
				$pdfTemplate->delete();
			} else {
				$this->debug->log('pdfTemplate is raw pdf data');
				$p->create_pvf($this->pvf, $pdfTemplate, '');
			}
			$pdfTemplate = null;
			$pdiNo = $p->open_pdi_document($this->pvf, $pdiOpts);
		} else {
			$this->debug->log('pdfTemplate', $pdfTemplate);
			$this->debug->log('file_exists', file_exists($pdfTemplate));
			try {
				$pdiNo = $p->open_pdi_document($pdfTemplate, $pdiOpts);
			} catch ( PDFlibException $e ) {
				trigger_error('PDFlib exception ['.$e->get_errnum().'] '.$e->get_apiname().' : '.$e->get_errmsg());
			}
			$this->debug->info('get_errmsg', $p->get_errmsg());
		}
		$this->debug->groupEnd();
		return $pdiNo;
	}
public function openPdf($pdfTemplate)
	{
		$this->debug->groupCollapsed(__CLASS__.'->'.__FUNCTION__);
		$p = $this->p;
		$pdiOpts = 'errorpolicy=return';
		if (is_object($pdfTemplate) || preg_match('/[\\x00-\\x1f]/', $pdfTemplate)) {
			if (is_object($pdfTemplate)) {
				$this->debug->log('pdfTemplate is object');
				$p->create_pvf($this->pvf, $pdfTemplate->get_buffer(), '');
				$pdfTemplate->delete();
			} else {
				$this->debug->log('pdfTemplate is raw pdf data');
				$p->create_pvf($this->pvf, $pdfTemplate, '');
			}
			$pdfTemplate = null;
			$pdiNo = $p->open_pdi_document($this->pvf, $pdiOpts);
		} else {
			$this->debug->log('pdfTemplate', $pdfTemplate);
			$this->debug->log('file_exists', file_exists($pdfTemplate));
			try {
				$pdiNo = $p->open_pdi_document($pdfTemplate, $pdiOpts);
			} catch ( PDFlibException $e ) {
				trigger_error('PDFlib exception ['.$e->get_errnum().'] '.$e->get_apiname().' : '.$e->get_errmsg());
			}
			$this->debug->info('get_errmsg', $p->get_errmsg());
		}
		$this->debug->groupEnd();
		return $pdiNo;
	}
public function openPdf ( $ pdfTemplate ) { $ this -> debug -> groupCollapsed ( __CLASS__ . '->' . __FUNCTION__ ) ; $ p = $ this -> p ; $ pdiOpts = 'errorpolicy=return' ; if ( is_object ( $ pdfTemplate ) || preg_match ( '/[\\x00-\\x1f]/' , $ pdfTemplate ) ) { if ( is_object ( $ pdfTemplate ) ) { $ this -> debug -> log ( 'pdfTemplate is object' ) ; $ p -> create_pvf ( $ this -> pvf , $ pdfTemplate -> get_buffer ( ) , '' ) ; $ pdfTemplate -> delete ( ) ; } else { $ this -> debug -> log ( 'pdfTemplate is raw pdf data' ) ; $ p -> create_pvf ( $ this -> pvf , $ pdfTemplate , '' ) ; } $ pdfTemplate = null ; $ pdiNo = $ p -> open_pdi_document ( $ this -> pvf , $ pdiOpts ) ; } else { $ this -> debug -> log ( 'pdfTemplate' , $ pdfTemplate ) ; $ this -> debug -> log ( 'file_exists' , file_exists ( $ pdfTemplate ) ) ; try { $ pdiNo = $ p -> open_pdi_document ( $ pdfTemplate , $ pdiOpts ) ; } catch ( PDFlibException $ e ) { trigger_error ( 'PDFlib exception [' . $ e -> get_errnum ( ) . '] ' . $ e -> get_apiname ( ) . ' : ' . $ e -> get_errmsg ( ) ) ; } $ this -> debug -> info ( 'get_errmsg' , $ p -> get_errmsg ( ) ) ; } $ this -> debug -> groupEnd ( ) ; return $ pdiNo ; }
Get PDI document

@param mixed $pdfTemplate input pdf filepath, raw pdf, or object

@return integer
Get PDI document