php - Image is not displaying using TCPDF -
i working in cakephp 3 application. here using tcpdf pdf generation. works fine except image. image not displaying.
here pdf() action file:
public function pdf() { $this->loadmodel('users'); $users=$this->users->find('all')->select(['firstname','lastname','email','image_path']); $this->set(compact('users')); $this->viewbuilder()->layout('pdf'); }
my pdf.ctp file :
$html = '<table>'; foreach($users $users) { $html .= '<tr> <td>' . $users['firstname'] . '</td> <td>' . $users['lastname'] . '</td> <td>' . $users['email'] . '</td> <td><img src="/sample/webroot/img/'.$users['image_path'].'"/></td> </tr>'; } $html .= '</table>'; $pdf->writehtml($html, true, false, true, false, '');
can 1 me , resolve problem ..
Comments
Post a Comment